#file #cat #file-content #line #command #extend #unix

bin+lib nrt

nrt is a Rust-based command-line tool that replicates and extends the functionality of the Unix cat command

1 unstable release

0.1.0 Aug 17, 2024

#2947 in Command line utilities

GPL-3.0 license

12KB
226 lines

nrt - A Rust-Based Clone of the cat Command

nrt is a lightweight and efficient command-line utility built in Rust, designed to replicate and extend the functionality of the classic Unix cat command. Whether you need to quickly view file contents, inspect file metadata, or perform basic file operations, nrt provides a versatile toolset.

Features

nrt enhances the standard cat command with the following capabilities:

  • File Size: Display the size of the file in bytes.
  • Creation Time: Show the creation time of the file in UTC.
  • Last Modified Time: Display the last modified time of the file in UTC.
  • File Permissions: List the file's mode (permissions) in numeric form.
  • Line Count: Count the total number of lines in the file.
  • Non-Empty Lines: Print all non-empty lines, each with its corresponding line number.
  • Rename Files: Rename the file to a new specified filename.
  • Copy File Content: Copy the entire content of the file.
  • Basic Concatenation: View the content of one or multiple files, similar to the standard cat command.

Installation

To install nrt, use cargo, Rust's package manager:

cargo install nrt

Usage

nrt is easy to use with a variety of options to suit your needs. The general syntax is:

nrt <filename> [OPTION]

# Options
    --size: Show the size of the file in bytes.
    --mt: Display the last modified time of the file in UTC.
    --ct: Display the creation time of the file in UTC.
    --mode: Show the file's mode (permissions) in numeric form.
    --lc: Count and display the number of lines in the file.
    --n: Print all non-empty lines with their line numbers.
    --cp: Copy the entire content of the file.
    --rn <new_filename>: Rename the file to a new specified filename.
    --help: Display a help message with usage instructions.

Contributing

Contributions are welcome! If you find a bug, have a feature request, or want to contribute in any way, feel free to open an issue or submit a pull request.


License

nrt is licensed under the GPL-3.0

Dependencies

~1.4–9.5MB
~91K SLoC