Project template·Pro
Rust CLI: line counter
A command-line tool in Rust that counts code, comment and blank lines per language in a folder. It's a Cargo project with no dependencies and has unit tests. It needs Rust and Cargo in the Linux environment (about 370 MB).
You need PocketCode Pro to install it.
If PocketCode is installed on your Android device, this opens the page in the app.
Preview
Files
Cargo.lock
Cargo.toml
README.md
src/count.rs
src/main.rsREADME.md
# loc: a Rust command-line tool Counts lines of code, comments and blank lines per language in a folder, like a small `cloc`. It skips `.git`, `target`, `node_modules` and other build or dependency folders. A Cargo project with no dependencies (only the standard library), split into two modules, with unit tests. ## Run it in PocketCode You need the app's Linux environment with Rust and Cargo (install it in Settings › Compilers and runtimes; about 370 MB). 1. Open the terminal in this project's folder (Open Terminal Here, in the editor menu). 2. Build and run it on this project: ```sh cargo run -- . ``` The first build takes a while on a phone; later ones only rebuild what changed. 3. Point it at any folder of your projects, and sort the table: ```sh cargo run -- ../other-project --sort files cargo run -- --help ``` You can also open `src/main.rs` and tap Run: it counts the `src` folder. ## Run the tests ```sh cargo test ``` ## Build a release binary ```sh cargo build --release ./target/release/loc ~/some/folder ``` ## Where things areThis preview is shortened. You get the full content when you install it.
Changes in 1.0.0
First version.