@carlosgtrz/pi-ansi-tools
v0.1.2
Published
Pi extension with read_ansi, write_ansi, and edit_ansi tools for legacy-encoded source files.
Maintainers
Readme
@carlosgtrz/pi-ansi-tools
Pi extension that adds tools for legacy-encoded source files, defaulting to windows-1252:
read_ansiwrite_ansiedit_ansi
Useful for Clarion .clw/.inc files and other legacy source formats.
Install
pi install npm:@carlosgtrz/pi-ansi-toolsTry without installing permanently:
pi -e npm:@carlosgtrz/pi-ansi-toolsFor one-off testing from this repo:
pi -e ./packages/ansi-toolsUsage
Once installed, Pi can call these tools when working with legacy-encoded source files.
The tools mirror Pi's built-in read, write, and edit tools, but add an encoding layer:
read_ansidecodes the source file to UTF-8 before calling the built-in read behavior.write_ansiencodes UTF-8 content back to the target legacy encoding before writing.edit_ansidecodes the source file to UTF-8, applies the same exact-replacement behavior as the built-in edit tool, then re-encodes the result before writing.
Use them the same way you would use Pi's built-in tools, with an optional encoding parameter. If omitted, the encoding defaults to windows-1252.
License
MIT
