|
1 | | -# kitten |
2 | | -A Rust implementation of the classic Unix `cat` command. |
| 1 | +# 🐱 kitten |
| 2 | + |
| 3 | +Kitten is a Rust-powered reimplementation of the classic Unix `cat` command — built as part of a broader mission to make Linux tools more **Rusty**, secure, and modern. |
| 4 | + |
| 5 | +It supports all common `cat` flags (including `-A`, `-v`, `-E`, `-T`, `-b`, `-n`, `-s`, `-e`, and `-t`) while offering a clean, safe codebase written entirely in Rust. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 🚀 Features |
| 10 | + |
| 11 | +- `-n`, `--number`: Number all output lines. |
| 12 | +- `-b`, `--number-nonblank`: Number non-blank lines only. |
| 13 | +- `-s`, `--squeeze-blank`: Suppress repeated blank lines. |
| 14 | +- `-E`, `--show-ends`: Display `$` at the end of each line. |
| 15 | +- `-T`, `--show-tabs`: Display tabs as `^I`. |
| 16 | +- `-v`, `--show-nonprinting`: Show non-printable characters (except tabs/newlines) as `^X`. |
| 17 | +- `-A`, `--show-all`: Equivalent to `-v -E -T`. |
| 18 | +- `-e`: Equivalent to `-v -E`. |
| 19 | +- `-t`: Equivalent to `-v -T`. |
| 20 | +- `-`: Read from standard input (stdin). |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## 📆 Installation |
| 25 | + |
| 26 | +### 🔹 Option 1: Download Prebuilt Release |
| 27 | + |
| 28 | +Grab the latest release from the [Releases page](https://github.com/Hunter2718/kitten/releases/#latest). Each release includes: |
| 29 | + |
| 30 | +- A precompiled binary: `kitten` |
| 31 | +- An `assets/` directory with: |
| 32 | + - `helpfile.txt` |
| 33 | + - `versionfile.txt` |
| 34 | + |
| 35 | +To install: |
| 36 | + |
| 37 | +```bash |
| 38 | +wget https://github.com/Hunter2718/kitten/releases/download/v1.0.0/kitten-x86_64.tar.gz |
| 39 | +tar -xf kitten-x86_64.tar.gz |
| 40 | +chmod +x kitten |
| 41 | +./kitten --help |
| 42 | +``` |
| 43 | + |
| 44 | +> 🔥 **Note**: The `assets/` directory must remain alongside the binary for help/version messages to work correctly. |
| 45 | +
|
| 46 | +### 🔹 Option 2: Build from Source (Requires cargo) |
| 47 | + |
| 48 | +```bash |
| 49 | +git clone https://github.com/Hunter2718/kitten.git |
| 50 | +cd kitten |
| 51 | +cargo build --release |
| 52 | +./target/release/kitten --help |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## 💪 Usage |
| 58 | + |
| 59 | +```bash |
| 60 | +kitten [FLAGS] [FILES]... |
| 61 | +``` |
| 62 | + |
| 63 | +### Examples |
| 64 | + |
| 65 | +- Number all lines: |
| 66 | + ```bash |
| 67 | + kitten -n file.txt |
| 68 | + ``` |
| 69 | + |
| 70 | +- Squeeze blank lines and show line ends: |
| 71 | + ```bash |
| 72 | + kitten -s -E file.txt |
| 73 | + ``` |
| 74 | + |
| 75 | +- Show tabs and non-printable characters: |
| 76 | + ```bash |
| 77 | + kitten -t -v file.txt |
| 78 | + ``` |
| 79 | + |
| 80 | +- Combine files and stdin: |
| 81 | + ```bash |
| 82 | + kitten -A - file1.txt file2.txt |
| 83 | + ``` |
| 84 | + |
| 85 | +- Read from standard input: |
| 86 | + ```bash |
| 87 | + echo -e "hi\tbye" | kitten -t - |
| 88 | + ``` |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 📂 Assets Directory |
| 93 | + |
| 94 | +Kitten uses an `assets/` directory to display user-facing information. |
| 95 | + |
| 96 | +- `assets/helpfile.txt`: Custom help output for `--help` |
| 97 | +- `assets/versionfile.txt`: Custom version output for `--version` |
| 98 | + |
| 99 | +These files are required at runtime and are bundled with releases. Keep them next to the binary. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## 🛠️ Transform Order |
| 104 | + |
| 105 | +Kitten applies flags in the following order (to match GNU `cat` behavior): |
| 106 | + |
| 107 | +1. `-s` squeeze blank lines |
| 108 | +2. `-T` show tabs |
| 109 | +3. `-v` show non-printables |
| 110 | +4. `-E` show ends |
| 111 | +5. `-n` or `-b` line numbering |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 📄 License |
| 116 | + |
| 117 | +This project is licensed under the [MIT License](LICENSE). |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 🌱 Project Goals |
| 122 | + |
| 123 | +Kitten is part of a broader initiative to **rewrite essential Linux command-line tools in Rust**, improving safety, readability, and long-term maintainability. |
| 124 | + |
| 125 | +This project aims to: |
| 126 | + |
| 127 | +- Deepen the developer’s understanding of systems-level Rust |
| 128 | +- Serve as a proof-of-concept for Rust-powered coreutils |
| 129 | +- Inspire others to join the Rustification of Linux |
| 130 | + |
| 131 | +--- |
| 132 | + |
| 133 | +## 🤝 Contributing |
| 134 | + |
| 135 | +Contributions, improvements, bug reports, and feature requests are welcome! |
| 136 | + |
| 137 | +- Fork the repo |
| 138 | +- Create a feature branch |
| 139 | +- Submit a pull request |
| 140 | + |
| 141 | +--- |
| 142 | + |
| 143 | +## 🐾 Author |
| 144 | + |
| 145 | +Made by me (**Hunter2718**) |
| 146 | +Find me on GitHub: [@Hunter2718](https://github.com/Hunter2718) |
| 147 | + |
| 148 | +For questions, feedback, or ideas, open an issue. |
| 149 | + |
0 commit comments