Goal: rewrite cat from GNU's coreutils in rust.
Why? To learn rust and programming.
requirements: cargo
git clone https://github.com/Skosulor/rcat
cd rcat
cargo build --release
path to rcat: rcat/target/release/rcat
rcat [FLAGS] [FILE]
if no file is given, input is taken from stdin
- If show-ends and number-nonblank flags are set the '$' sign in blank lines will have the same line start as numbered lines. This shall be kept as a feature as it looks neater.
- When flag show-nonprinting flag (-v) is set, non-ascii characters are printed as '^?'
- Note: Untested on anything that is not a file, directory or stdin.
- Read file
- print file
- Read from stdin and print
- Handle input error
- Options
- -A, --show-all equivalent to -vET
- -b, --number-nonblank
- -e, equivalent to -vE
- -E, --show-ends
- -n, --number
- -s, --squeeze blank
- -t equivalent to -vT
- -T, --show-tabs
- -u (ignored)
- -v, --show-nonprinting
- Print actual control sequences instead of '^?' when show-nonprinting flag is set.
- Add path (if there was one) to error messages
- FIXED: cannot open non UTF-8 encoded files, e.g. opening a binary file produces an error.