Giter Site home page Giter Site logo

wyhaya / lok Goto Github PK

View Code? Open in Web Editor NEW
47.0 2.0 5.0 27 KB

Count the number of codes

License: MIT License

JavaScript 0.46% Rust 91.21% CSS 0.37% Go 0.22% HTML 0.50% PHP 0.27% Python 0.32% Shell 2.65% Swift 0.79% TypeScript 0.49% C 0.03% Ruby 0.25% Vue 0.51% Sass 0.35% SCSS 0.35% Kotlin 0.24% Clojure 0.97%
count count-lines count-lines-of-code codes command-line-tool

lok's Introduction

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

lok's People

Contributors

0323pin avatar dependabot[bot] avatar iamwacko avatar jianglu avatar vollcheck avatar wyhaya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lok's Issues

What happened to the commit history?

The commits history only shows commits since 2022-05-09 and the first commit is a complete rewrite, where in fact this project is few years old. I wonder why this has happened.

Directory name 'helper' is not accepted

Trying to apply the command to a directory name helper results in a The subcommand 'helper' wasn't recognized error. The same happens when running lok ./helper and lok helper.

As a workaround, lok $(pwd)/helper works.

Version: lok 0.2.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.