1 unstable release
new 0.1.0 | Mar 19, 2025 |
---|
#109 in Value formatting
94 downloads per month
49KB
896 lines
šØ Seqsee
Human-readable ANSI sequences for Rust.
Seqsee is a specialized command-line tool designed to demystify ANSI escape sequences. It helps developers debug terminal-based applications by translating cryptic control codes into human-readable explanations. Whether you're troubleshooting cursor positioning issues, color rendering problems, or trying to understand how terminal applications manipulate the display, Seqsee provides clarity by revealing what's happening beneath the surface of your terminal.
š Installation
From Source
# Clone the repository
git clone https://github.com/KirillFurtikov/seqsee.git
cd seqsee
# Build the project
cargo build --release
# Install the binary
cargo install --path .
š” Usage
š Describing escape sequences
Just use printf
to send some sequences to seqsee
for an explanation:
printf "\x1b[36mRust\x1b[1;4m is \x1b[41m awesome\x1b[0m\r\n\b" | seqsee
This will output a detailed breakdown of each ANSI sequence:
Type Esc Desc
CSI \x1b[36m Set mode: Foreground color: 6
Text Rust Rust
CSI \x1b[1;4m Set mode: Bold, Underline
Text is is
CSI \x1b[41m Set mode: Background color: 1
Text awesome awesome
CSI \x1b[0m Set mode: Reset all
Ctrl \r Carriage return
Ctrl \n Line feed (new line)
Ctrl \b Backspace
š Reading text files with escape sequences
You can parse files containing ANSI escape sequences:
seqsee -f test_ansi.txt
For example, with a file containing:
\e[38;5;208mWarning:\e[0m \e[3mSystem\e[0m \e[4;32mstatus\e[0m: \e[1;5;33mCRITICAL\e[0m\nCursor demo: \e[3A\e[5Cā here\e[3B\e[8Cā there
Seqsee will parse both the actual escape sequences and also the literal \e
escape notations.
š¬ Examining command output
Many commands use ANSI sequences for colorized output. You can analyze them with seqsee:
ls --color=always | seqsee
git -c color.status=always status | seqsee
Note: Many programs disable colored output when piping. Use flags like --color=always
to force them to include ANSI sequences.
šÆ Raw Mode
For a cleaner view of the text with highlighted sequences:
ls --color=always | seqsee --raw
āØ Supported ANSI Features
Seqsee supports parsing and explaining a wide range of ANSI escape sequences:
š±ļø Cursor Movement
- Cursor Up/Down/Forward/Backward
- Cursor Position (absolute and relative)
- Save/Restore cursor position
- Column positioning
šØ Text Formatting
- Text styling (bold, italic, underline, etc.)
- 16-color mode (30-37, 40-47, 90-97, 100-107)
- 256-color mode (38;5;n and 48;5;n)
- RGB true color (38;2;r;g;b and 48;2;r;g;b)
š„ļø Screen Control
- Erase in display/line
- Scrolling
- Window manipulation
āļø Terminal Modes
- Application/Numeric keypad mode
- Character sets
- Various terminal modes (like mouse tracking)
š Project Structure
seqsee/
āāā src/
ā āāā ansi/ # ANSI sequence definitions
ā ā āāā csi.rs # CSI (Control Sequence Introducer) commands
ā ā āāā ctrl.rs # Control characters
ā ā āāā mod.rs # Module definitions
ā āāā output/ # Output formatting
ā ā āāā raw.rs # Raw output formatter
ā ā āāā table.rs # Table output formatter
ā ā āāā mod.rs # Module definitions
ā āāā parser.rs # ANSI sequence parser
ā āāā formatter.rs # Formatter trait
ā āāā main.rs # CLI application
āāā test_ansi.txt # Example ANSI test file
š¤ Contributing
Contributions are welcome! Here are some ways you can contribute:
- Report bugs and feature requests
- Improve documentation
- Fix bugs and implement features
- Add support for additional ANSI sequences
š License
This project is licensed under the MIT License.
Dependencies
~4.5MB
~79K SLoC