- Notifications
You must be signed in to change notification settings - Fork562
Count your code, quickly.
License
Unknown, MIT licenses found
Licenses found
XAMPPRocky/tokei
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Tokei (時計)
Tokei is a program that displays statistics about your code. Tokei will show the number of files, total lines within those files and code, comments, and blanks grouped by language.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Language Files Lines Code Comments Blanks━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BASH 4 49 30 10 9 JSON 1 1332 1332 0 0 Shell 1 49 38 1 10 TOML 2 77 64 4 9─────────────────────────────────────────────────────────────────────────────── Markdown 5 1355 0 1074 281 |- JSON 1 41 41 0 0 |- Rust 2 53 42 6 5 |- Shell 1 22 18 0 4 (Total) 1471 101 1080 290─────────────────────────────────────────────────────────────────────────────── Rust 19 3416 2840 116 460 |- Markdown 12 351 5 295 51 (Total) 3767 2845 411 511━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Total 32 6745 4410 1506 829━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Features
- Installation
- Configuration
- How to use Tokei
- Options
- Badges
- Supported Languages
- Changelog
- Common Issues
- Canonical Source
- Copyright and License
Tokei isvery fast, and is able to count millions of lines of code in seconds.Check out the11.0.0 releaseto see how Tokei's speed compares to others.
Tokei isaccurate, Tokei correctly handles multi line comments,nested comments, and not counting comments that are in strings. Providing anaccurate code statistics.
Tokei has huge range of languages, supporting over150 languages, andtheir various extensions.
Tokei can output in multiple formats(CBOR,JSON,YAML)allowing Tokei's output to be easily stored, and reused. These can also bereused in tokei combining a previous run's statistics with another set.
Tokei is available onMac,Linux, andWindows. Seeinstallationinstructions for how to get Tokei on your platform.
Tokei is also alibrary allowing you to easily integrate it with otherprojects.
Tokei comes with and without color. Set the env variable NO_COLOR to 1, andit'll be black and white.
#Alpine Linux (since 3.13)apk add tokei#Arch Linuxpacman -S tokei#Cargocargo install tokei#Condaconda install -c conda-forge tokei#Fedorasudo dnf install tokei#FreeBSDpkg install tokei#NetBSDpkgin install tokei#Nix/NixOSnix-env -i tokei#OpenSUSEsudo zypper install tokei#Void Linuxsudo xbps-install tokei
#Homebrewbrew install tokei#MacPortssudo port selfupdatesudo port install tokei
#Wingetwinget install XAMPPRocky.tokei#Scoopscoop install tokei
You can download prebuilt binaries in thereleases section.
You can also build and install from source (requires the latest stableRust compiler.)
cargo install --git https://github.com/XAMPPRocky/tokei.git tokei
Tokei has aconfiguration file that allows you to change default behaviour.The file can be namedtokei.toml
or.tokeirc
. Currently tokei looks forthis file in three different places. The current directory, your home directory,and your configuration directory.
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,or a space followed by another path.
$ tokei ./foo ./bar ./baz
$ tokei ./foo, ./bar, ./baz
Tokei will respect all.gitignore
and.ignore
files, and you can usethe--exclude
option to exclude any additional files. The--exclude
flag hasthe same semantics as.gitignore
.
$ tokei ./foo --exclude*.rs
Paths to exclude can also be listed in a.tokeignore
file, using the samesyntax as .gitignore files.
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 terminals.There is also using the--output
option various other formats that are moreuseful for bringing the data into another program.
Note: This version of tokei was compiled without any serialization formats, to enable serialization, reinstalltokei with the features flag.
ALL: cargo install tokei --features all CBOR: cargo install tokei --features cbor YAML: cargo install tokei --features yaml
Currently supported formats
- JSON
--output json
- YAML
--output yaml
- CBOR
--output cbor
$ tokei ./foo --output json
Tokei can also take in the outputted formats added in the previous results to itscurrent run. Tokei can take either a path to a file, the format passed in as avalue to the option, or from stdin.
$ tokei ./foo --input ./stats.json
USAGE: tokei [FLAGS] [OPTIONS] [--] [input]...FLAGS: -f, --files Will print out statistics on individual files. -h, --help Prints help information --hidden Count hidden files. -l, --languages Prints out supported languages and their extensions. --no-ignore Don't respect ignore files (.gitignore, .ignore, etc.). This implies --no-ignore-parent, --no-ignore-dot, and --no-ignore-vcs. --no-ignore-dot Don't respect .ignore and .tokeignore files, including those in parent directories. --no-ignore-parent Don't respect ignore files (.gitignore, .ignore, etc.) in parent directories. --no-ignore-vcs Don't respect VCS ignore files (.gitignore, .hgignore, etc.), including those in parent directories. -V, --version Prints version information -v, --verbose Set log output level: 1: to show unknown file extensions, 2: reserved for future debugging, 3: enable file level trace. Not recommended on multiple filesOPTIONS: -c, --columns <columns> Sets a strict column width of the output, only available for terminal output. -e, --exclude <exclude>... Ignore all files & directories matching the pattern. -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. Compile with additional features for more format support. [possible values: cbor, json, yaml] -s, --sort <sort> Sort languages based on column [possible values: files, lines, blanks, code, comments] -t, --type <types> Filters output by language type, separated by a comma. i.e. -t=Rust,MarkdownARGS: <input>... The path(s) to the file or directory to be counted.
Tokei has support for badges. For example.
[](https://github.com/XAMPPRocky/tokei).
Tokei's URL scheme is as follows.
https://tokei.rs/b1/{host: values: github|gitlab}/{Repo Owner eg: XAMPPRocky}/{Repo name eg: tokei}
By default the badge will show the repo's LoC(Lines of Code), you can alsospecify for it to show a different category, by using the?category=
querystring. It can be eithercode
,blanks
,files
,lines
,comments
,Example show total lines:
[](https://github.com/XAMPPRocky/tokei).
The server code hosted on tokei.rs is inXAMPPRocky/tokei_rs
Tokei is available in a smallalpine
-based docker image, buildable throughearthly:
earthly +docker
Once built, one can run the image with:
docker run --rm -v /path/to/analyze:/src tokei.
Or, to simply analyze the current folder (linux):
docker run --rm -v$(pwd):/src tokei.
If there is a language that you would to add to tokei feel free to make a pullrequest. Languages are defined inlanguages.json
, and you canread how to add and test your language in ourCONTRIBUTING.md.
AbapActionScriptAdaAgdaAlexAlloyAPLAsn1AspAspNetAssemblyAssemblyGASATSAutoconfAutoHotKeyAutomakeAWKBashBatchBazelBeanBicepBitbakeBQNBrightScriptCCabalCassiusCeylonCHeaderCilClojureClojureCClojureScriptCMakeCobolCoffeeScriptCogentColdFusionColdFusionScriptCoqCppCppHeaderCrystalCSharpCShellCssCudaCUECythonDD2DAMLDartDeviceTreeDhallDockerfileDotNetResourceDreamMakerDustEbuildEdgeDBEdnElispElixirElmElvishEmacsDevEnvEmojicodeErlangFactorFENFishFlatBuffersForgeConfigForthFortranLegacyFortranModernFreeMarkerFSharpFstarGDBGdScriptGdShaderGherkinGleamGlslGoGraphqlGroovyGwionHamletHandlebarsHappyHareHaskellHaxeHclHexHiCADhledgerHlslHolyCHtmlHyIdrisIniIntelHexIsabelleJaiJanetJavaJavaScriptJqJsonJsxJuliaJuliusJustKakouneScriptKotlinLeanLessLingua FrancaLinkerScriptLiquidLispLLVMLogtalkLuaLuciusMadlangMaxMakefileMarkdownMdxMesonMintMlatuModuleDefMonkeyCMoonScriptMsBuildMustacheNimNixNotQuitePerlNuGetConfigNushellObjectiveCObjectiveCppOCamlOdinOpenSCADOpenQASMOrgOzPascalPerlPerl6PestPhixPhpPoPokePollyPonyPostCssPowerShellProcessingPrologProtobufPRQLPSLPureScriptPyretPythonQclQmlRRacketRakefileRazorRenpyReStructuredTextRONRPMSpecfileRubyRubyHtmlRustSassScalaSchemeSconsShShaderLabSlangSmlSoliditySpecmanESpiceSqlSRecodeStataStrategoSvelteSvgSwiftSwigSystemVerilogSlintTactTclTemplTexTextThriftTomlTsxTwigTypeScriptUMPLUnrealDeveloperMarkdownUnrealPluginUnrealProjectUnrealScriptUnrealShaderUnrealShaderHeaderUrWebUrWebProjectValaVB6VBScriptVelocityVerilogVerilogArgsFileVhdlVimScriptVisualBasicVisualStudioProjectVisualStudioSolutionVueWebAssemblyWolframXamlXcodeConfigXmlXSLXtendYamlZenCodeZigZoKratesZsh
This is likely due togcc
generating.d
files. Until the D people decide ona different file extension, you can always exclude.d
files using the-e --exclude
flag like so
$ tokei . -e *.d
The canonical source of this repo is hosted onGitHub. If you have a GitHub account,please make your issues, and pull requests there.
- tokei-pie: Render tokei's output tointeractive sunburst chart.
(C) Copyright 2015 by XAMPPRocky and contributors
Seethe graph for a full list of contributors.
Tokei is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
SeeLICENCE-APACHE,LICENCE-MIT for more information.
About
Count your code, quickly.