1 unstable release

0.1.0 Sep 8, 2024

#530 in Command line utilities

Download history 86/week @ 2024-09-02 66/week @ 2024-09-09

152 downloads per month

MIT license

31KB
853 lines

SuperCat 🐱

cat you see!? It's a fancy super cat! 🐱

supercat

SuperCat is a syntax highlighting alternative to the traditional cat command-line utility. It provides colorful and easy-to-read output for various programming languages and file types, powered by tree-sitter and the Helix editor's syntax highlighting engine.

Features

  • Syntax highlighting for multiple programming languages using tree-sitter
  • Automatic language detection based on file extension or content
  • Option to display line numbers
  • Customizable color theme
  • Support for reading from files or standard input
  • Powered by the Helix editor's syntax highlighting engine

Why SuperCat?

SuperCat offers advantages over similar tools:

  1. Advanced syntax highlighting: SuperCat uses tree-sitter through the Helix editor's syntax highlighting engine. This provides more accurate and context-aware parsing compared to regex-based highlighters, resulting in better highlighting for complex language constructs. It also benefits from Helix's performance optimizations and support for a wide range of languages.

  2. Lightweight: SuperCat is designed to be a lightweight alternative, focusing on fast startup times and efficient memory usage.

  3. Customizability(soon): The color theme in SuperCat is easily customizable, allowing users to tailor the output to their preferences.

Installation

You can install SuperCat using Cargo, the Rust package manager:

cargo install supercat

Alternatively, you can build from source:

git clone https://github.com/guilhermeprokisch/supercat.git
cd supercat
cargo build --release

The built binary will be available in target/release/supercat.

Usage

supercat [OPTIONS] [FILE]

If no file is specified, SuperCat will read from standard input.

Options

  • -l, --line-numbers: Show line numbers
  • --language <LANGUAGE>: Force a specific language for syntax highlighting

Examples

  1. Display a file with syntax highlighting:

    supercat example.rs
    
  2. Display a file with line numbers:

    supercat -l example.py
    
  3. Force a specific language:

    supercat --language javascript example.txt
    
  4. Read from standard input:

    echo "print('Hello, World!')" | supercat --language python
    

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Dependencies

~545MB
~16M SLoC