lok

Crates.iolok
lib.rslok
version0.2.5
sourcesrc
created_at2019-07-03 03:11:36.075425
updated_at2024-04-15 09:26:58.507065
descriptionCount the number of codes
homepagehttps://github.com/wyhaya/lok
repositoryhttps://github.com/wyhaya/lok.git
max_upload_size
id145545
size46,382
(wyhaya)

documentation

README

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 │
├──────────────────────────────────────────────────────────────────────────────┤
│ CSS                   6384           9          40         108     145.89 KB │
│ HTML                    19           0           0           1       1011 B  │
│ JSON                   205           0           0         110      13.25 KB │
│ JavaScript             206           8           1         113     590.14 KB │
│ Markdown                 8           0           5           1        229 B  │
│ TypeScript JSX       14733         262         800         109     530.76 KB │
│ TypeScript             680          57          57           8      22.07 KB │
│ YAML                     5           0           0           1         83 B  │
├──────────────────────────────────────────────────────────────────────────────┤
│ Total               22,240         336         903         451       1.27 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

A native package is available on NetBSD from the official repositories. To install it, simply run

pkgin install lok

A package on the AUR is also available. To install it simply run with your favorite AUR helper

paru 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

Commit count: 16

cargo fmt