Tokei (時計)
Tokei is a program that allows you to count code, quickly.
- Canonical Source
- Installation
- How to use Tokei
- Options
- Supported Languages
- Changelog
- Common Issues
- Copyright
The canonical source of this repo is hosted on GitHub. If you have a GitHub account, please make your issues, and pull requests there.
If you have cargo 0.6.0>=
installed just run the cargo install
command.
$ cargo install tokei
Install rust and cargo from either the official page or use a copr repo such as Rust
$ dnf copr enable phnxrbrn/tokei
$ dnf install tokei
$ git clone https://github.com/Aaronepower/tokei.git
$ cd tokei
$ cargo build --release
# sudo mv target/release/tokei /usr/local/bin
# sudo mv target/release/tokei /usr/local/bin/tokei
- Create a folder for tokei
- search for
env
- open "edit your enviroment variables"
- edit
PATH
- append folder path to the end of the string ie:
<path_stuff_here>;C:/tokei/;
This is the basic way to use tokei. Which will report on the code in ./foo
and all subfolders.
$ tokei ./foo
To have tokei report on multiple folders in the same call simply add a comma followed by another path.
$ tokei ./foo, ./bar, ./baz
The --exclude
option will allow to pass in a sequence of string to exclude any path including those words
$ tokei ./foo --exclude node_modules, target
By default tokei sorts alphabetically by language name, however using --sort
tokei can also sort by any of the columns.
blanks, code, comments, lines
$ tokei ./foo --sort code
By default tokei only outputs the total of the languages, and using --files
flag tokei can also output individual file statistics.
$ tokei ./foo --files
Tokei normally outputs into a nice human readable format designed for the terminal.
There is also using the --output
option various other formats that are more useful for bringing the data into another program.
Current supported formats
- JSON
--output json
- YAML
--output yaml
- TOML
--output toml
- CBOR
--output cbor
$ tokei ./foo --output json
Tokei can also take in the outputted formats added the previous results to it's current run. Tokei can take either a path to a file, the format passed in as a value to the option, or from stdin.
$ tokei ./foo --input ./stats.json
Tokei 3.0.0
Aaron P. <theaaronepower@gmail.com>
Count Code, Quickly.
USAGE:
Tokei [FLAGS] [OPTIONS] <input>...
FLAGS:
-f, --files Will print out statistics on individual files.
-h, --help Prints help information
-l, --languages Prints out supported languages and their extensions.
-V, --version Prints version information
OPTIONS:
-e, --exclude <exclude> Ignore all files & directories containing the word.
-i, --input <file_input> Gives statistics from a previous tokei run. Can be given a file path, or "stdin" to read from stdin.
-o, --output <output> Outputs Tokei in a specific format. [values: cbor, json, toml, yaml]
-s, --sort <sort> Will sort based on column [values: files, lines, blanks, code, comments]
ARGS:
<input>... The input file(s)/directory(ies)
If there is a language that you want added submit a pull request with the following information
- Name of language
- File Extension
- The comment syntax (Does it have block comments? is it the same as C?)
ActionScript
Assembly
Autoconf
BASH
Batch
C
C Header
Clojure
CoffeeScript
ColdFusion
ColdFusion CFScript
Coq
C++
C++ Header
C#
C Shell
CSS
D
Dart
Device Tree
Erlang
FORTRAN Legacy
FORTRAN Modern
Go
Haskell
HTML
Idris
Isabelle
JAI
Java
JavaScript
Julia
JSON
JSX
Kotlin
LESS
LD Script
LISP
Lua
Makefile
Markdown
Mustache
Nim
Objective C
Objective C++
OCaml
Oz
Pascal
Perl
Polly
PHP
Protocol Buffers
Prolog
Python
QCL
R
Ruby
Ruby HTML
Rust
Sass
Scala
Standard ML
SQL
Swift
TeX
Plain Text
TOML
TypeScript
Vim Script
Unreal Script
Wolfram
XML
YAML
Zsh
This is likely due to gcc
generating .d
files. Until the D people decide on a different file extension, you can always exclude .d
files using the -e --exclude
flag like so
$ tokei . -e .d
(C) Copyright 2015 by Aaron Power and contributors
See CONTRIBUTORS.md for a full list of contributors.
Tokei is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENCE-APACHE, LICENCE-MIT for more information.