13 releases

new 0.1.2 Jan 13, 2021
0.1.1 Jul 30, 2020
0.0.9 May 15, 2020
0.0.8 Apr 1, 2020
0.0.0-alpha.0 Jul 3, 2019

#84 in Command line utilities

25 downloads per month

MIT license

29KB
735 lines

lok

GitHub Workflow Status Crates.io LICENSE

lok is a command line tool, that is used to quickly calculate the number of lines of various language codes in a project

┌──────────────────────────────────────────────────────────────────────────────┐
| Language              Code     Comment       Blank        File          Size |
├──────────────────────────────────────────────────────────────────────────────┤
| HTML                   360           0          27          13      24.97 KB |
| JavaScript             238         240          79          22     935.95 KB |
| JavaScript JSX       26570        2011        4096         299     766.10 KB |
| JSON                    81           0           3           4       1.97 KB |
| Markdown                31           0          13           1      882.00 B |
| TypeScript              57           6          12           3       3.78 KB |
| TypeScript JSX         691          78          46          10      19.12 KB |
| YML                      4           0           0           1       58.00 B |
├──────────────────────────────────────────────────────────────────────────────┤
| Total               28,032       2,335       4,276         353       1.71 MB |
└──────────────────────────────────────────────────────────────────────────────┘

Features

  • Quickly calculate data
  • Support multiple languages
  • Support multiple output formats, ASCII, HTML, Markdown

Install

Download the binary from the release page

Or use cargo to install

cargo install lok

Use

Go to your project in the terminal and type lok on the command line

cd your-project
lok

# Change working directory
lok /root/code
# Exclude all files matched by glob
lok -e './node_modules/**'

# Exclude all files with the specified extension
lok -e '**/*.ts' '**/*.js'
# Include only files matching glob
lok -i './src/*.rs'
# Only count files containing extensions
lok --extension js ts jsx tsx
# Output other formats: table, html, markdown
lok -o markdown

# Save to file
lok -o html > code.html
lok -o markdown > code.md
# Sort by: language, code, comment, blank, file, size
lok -s code

Contributing

If you want to add statistics for other languages, please update config.rs

Example:

language!(
    "Rust", 
    vec!["rs"], 
    vec!["//", "///"], 
    vec![("/*", "*/")]
);
// ...

Benchmark

First need to install

cargo install hyperfine loc tokei

Run

./benchmark

License

MIT LICENSE

Dependencies

~1MB
~17K SLoC