Skip to content

Commit e67ad3c

Browse files
author
Hunter2718
committed
VERSION 1.0.0: It now does everything cat does
1 parent cafd333 commit e67ad3c

File tree

4 files changed

+200
-16
lines changed

4 files changed

+200
-16
lines changed

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2025 [Hunter2718](https://github.com/Hunter2718)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+

README.md

Lines changed: 149 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,149 @@
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+

kitten/assets/helpfile.txt

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
Kitten 🐾 - A Rusty clone of the Unix 'cat' command.
1+
Kitten - A Rusty clone of the Unix cat command
22

3-
Usage:
4-
kitten <file1> <file2> ... Read and print contents of one or more files.
5-
kitten Read from standard input (pipe data in).
3+
USAGE:
4+
kitten [FLAGS] [FILES]...
65

7-
Options:
8-
-h, --help Show this help message and exit.
6+
FLAGS:
7+
-n, --number Number all output lines
8+
-b, --number-nonblank Number non-blank output lines only
9+
-s, --squeeze-blank Suppress repeated blank lines
10+
-E, --show-ends Display $ at end of each line
11+
-T, --show-tabs Display tab characters as ^I
12+
-v, --show-nonprinting Show non-printing characters (except \t and \n)
13+
-A, --show-all Equivalent to -vET
14+
-e Equivalent to -vE
15+
-t Equivalent to -vT
16+
--help Display this help message
17+
--version Show version information
918

10-
Examples:
11-
kitten file.txt Prints file.txt to stdout.
12-
kitten file1.txt file2.txt Prints both files in order.
13-
echo "hello" | kitten Prints stdin input to stdout.
19+
Reads from standard input when no files are given
1420

15-
About:
16-
Kitten is a learning project by https://github.com/Hunter2718
17-
It's a safe and fast reimplementation of 'cat' in Rust.
1821

22+
NOTES:
23+
24+
Multiple flags can be combined (e.g., -v -E), but not squashed (e.g., -vE won't work)
25+
26+
Files are read in order; - indicates stdin
27+
28+
For more information check out my official github at https://github.com/Hunter2718
29+
30+
31+
OTHER WORK:
32+
33+
My other work can be found at https://github.com/Hunter2718

kitten/assets/versionfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
kitten 0.1.0
1+
kitten 1.0.0
22

33
by https://github.com/Hunter2718

0 commit comments

Comments
 (0)