{"id":30355746,"url":"https://github.com/rudxain/loc.rs","last_synced_at":"2025-08-19T05:14:22.842Z","repository":{"id":302759679,"uuid":"1012535584","full_name":"Rudxain/loc.rs","owner":"Rudxain","description":"Recursively count lines-of-content (not code)","archived":false,"fork":false,"pushed_at":"2025-07-27T03:00:05.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-27T05:19:36.703Z","etag":null,"topics":["blazing-fast","cli","compiled-language","crate","directory-traversal","grep-like","line-count","no-dependencies","recursive","size","statistics","tree-traversal","unix-like","utf-8","utility"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rudxain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-02T13:33:43.000Z","updated_at":"2025-07-27T03:00:08.000Z","dependencies_parsed_at":"2025-07-04T05:18:43.386Z","dependency_job_id":"a8ef3af1-c969-490b-9029-7a45910ceb00","html_url":"https://github.com/Rudxain/loc.rs","commit_stats":null,"previous_names":["rudxain/loc.rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rudxain/loc.rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rudxain%2Floc.rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rudxain%2Floc.rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rudxain%2Floc.rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rudxain%2Floc.rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rudxain","download_url":"https://codeload.github.com/Rudxain/loc.rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rudxain%2Floc.rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271103202,"owners_count":24699646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazing-fast","cli","compiled-language","crate","directory-traversal","grep-like","line-count","no-dependencies","recursive","size","statistics","tree-traversal","unix-like","utf-8","utility"],"created_at":"2025-08-19T05:14:21.962Z","updated_at":"2025-08-19T05:14:22.834Z","avatar_url":"https://github.com/Rudxain.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LOC\nRecursively counts non-empty lines that contain at least 1 non-whitespace character.\n\nIt uses the [Unicode definition of \"whitespace\" (according to Rust-std-lib)](https://doc.rust-lang.org/std/primitive.char.html#method.is_whitespace), and the [POSIX definition of \"line\"](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_185). Yeah, very inconsistent, I know.\n\n\u003e [!WARNING]\n\u003e This might stay sem-ver unstable for a while. Even the **commit hashes are subject to change**\n\nI have no plans of supporting source-comments (exclude comments from counts), as that requires language-awareness. I want this to be useful enough, while being \"simple\" and lang-agnostic.\n\nIf you really want lang-support, I recommend [Tokei](https://github.com/XAMPPRocky/tokei). One of the reasons why I wrote this program was because [`cloc`](https://github.com/AlDanial/cloc) is too complex and slow. See also: [`uwc`](https://github.com/dead10ck/uwc).\n\n## Usage\n\n### Install\nThis needs a `rustc` and `cargo` (tested on `nightly`, but should work with `stable`). Recommended command:\n```sh\ncargo install --path . --config 'build.rustflags=\"-C target-cpu=native\"'\n```\nAssuming you've downloaded and `cd`ed into the repo\n\n### Run\nInvoke the program by passing the paths whose counts you want to get:\n```sh\n# example\nloc file.txt smol-directory 'BIG dir/'\n16\tfile.txt\n255\tsmol-directory\n20069\tBIG dir/\n# stats are printed as soon as each count is computed\n```\nOr simply pass nothing, if you want _sorted_ stats about WD (equivalent to `loc ./* .[!.]* | sort -rn`), but you'll have to wait until all results are computed. This is kinda similar to how `du` works, even the output format is similar; both are intentional design decisions.\n\nThis program is single-threaded, as it's IO-bound.\n\nUnlike most CLIs, this program doesn't recognize any options or flags (yet), so arguments prefixed with `-` are treated as any other arg. I might add `--help` \u0026 `-h` flags, but that seems overkill.\n\nNon-UTF8 args are supported, to allow arbitrary file-names, and for lower startup overhead. However, **non-UTF8 files are excluded** from counts, as the concept of \"non-blank line\" doesn't exist in raw-binary (according to Unicode, not POSIX). Sadly, this also excludes UTF-{16,32}.\n\n\u003e Side-note: I was **blown away** by how blazing-fast this program is, **even in debug mode!**\n\u003e At least, when compared to [the equivalent shell-script](loc.sh).\n\u003e\n\u003e No wonder [`rg`](https://github.com/BurntSushi/ripgrep) is so fast! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudxain%2Floc.rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frudxain%2Floc.rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudxain%2Floc.rs/lists"}