#character #count #cli #rust

app count-characters

A simple Rust program to count characters in a string

4 releases

new 0.1.4 May 4, 2025
0.1.3 May 3, 2025
0.1.2 Apr 29, 2025
0.1.1 Apr 26, 2025

#1324 in Command line utilities

Download history 204/week @ 2025-04-26

204 downloads per month

GPL-2.0 license

7KB

Count Characters

Table of Contents

Crates.io Version Crates.io Total Downloads Crates.io Size (version)

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 some-rust-scripts
cd count-characters

Install the binary (optional, requires sudo):

just install
# or from crates.io:
cargo install count-characters

To uninstall:

just uninstall
# or from crates.io:
cargo uninstall count-characters

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