1 unstable release
new 0.1.1 | Apr 26, 2025 |
---|
#1600 in Command line utilities
13KB
Count Characters
Table of Contents
About
Count Characters is a simple CLI tool written in Rust that counts the number of characters in a given input, including support for reading from files. It trims leading and trailing blank lines and is designed for quick, efficient use in the terminal.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
- Rust (version 1.86.0 or later)
- Cargo (comes with Rust)
Installing
Clone the repository:
git clone https://github.com/anhkhoakz/some-rust-scripts/
cd count-characters
Build the project:
make build
Install the binary (optional, requires sudo):
make install
To uninstall:
make uninstall
Usage
You can run the tool with:
./target/release/count-characters
Or, if installed:
count-characters
Paste your text, then press Ctrl-D
(on Mac/Linux) or Ctrl-Z
(on Windows) to finish input. The tool will output the number of characters in your input (excluding leading/trailing blank lines).
Example:
$ count-characters
Paste your text, then press Ctrl-D (on Mac/Linux) or Ctrl-Z (on Windows) to finish:
Hello, world!
Input contains 13 characters.
$ count-characters /path/to/file.txt
Input contains 42 characters.
License
This project is licensed under the GNU General Public License version 2 - see the LICENSE file for details.
Dependencies
~1–1.6MB
~30K SLoC