composition-cli-2.1.1 is not a library.
Visit the last successful build:
composition-cli-2.0.2

composition
composition is a modular lines-of-code CLI tool to analyze and display code composition in directories
Features
- Multi-language tracking - Analyze code by file extensions with customizable language groupings
- Smart filtering - Respect
.gitignore, exclude dotfiles/dotfolders, and apply custom ignore patterns - Global & language-specific exclusions - Define regex patterns globally or per-language for precise line filtering
- Parallel processing - Efficiently analyze large codebases with parallelized file processing
- Configurable analysis - TOML-based configuration with CLI overrides for flexible usage
- Visual contribution bars - Scalable visual representation of code composition with optional color coding
Setup
-
Install Binary
- crates.io
- Build from Source
# built binary can be found at ./target/release/composition -
Create
config.tomlat:- Linux / Unix
- macOS
- Windows
%appdata%/composition/config.toml- Or the default configuration directory on your system
-
Populate based on configuration guidelines
NOTE: A missing/invalid config.toml results in falling back to the default
Usage
| Flag / Argument | Type | Default | Description |
|---|---|---|---|
PATH |
Optional<Path> |
Path('.') |
Path to the directory of files to process. |
--scale-bar |
Optional<float> |
1.0 |
Scale factor for the contribution bar. |
--use-color |
Optional<bool> |
config* | Override use_color config setting. |
--log-scale |
Optional<bool> |
config* | Override log_scale config setting. |
--respect-gitignore |
Optional<bool> |
config* | Override respect_gitignore config setting. |
--ignore-dotfolders |
Optional<bool> |
config* | Override ignore_dotfolders config setting. |
--ignore-dotfiles |
Optional<bool> |
config* | Override ignore_dotfiles config setting. |
--ignore-empty-lines |
Optional<bool> |
config* | Override ignore_empty_lines config setting. |
config* : Defaults to the value defined in the
config.tomlfile [or its default]
NOTE: command-line flags take precedence over values in
config.toml
Configuration Guidelines
config.toml fields:
| Field Name | Type | Default Value | Description |
|---|---|---|---|
use_color |
Optional<bool> |
false |
Enables colored output in the CLI |
log_scale |
Optional<bool> |
false |
Enables logarithmic scale for the contribution bar |
respect_gitignore |
Optional<bool> |
true |
Determines whether files/folders ignored by .gitignore should also be ignored by this tool |
ignore_dotfolders |
Optional<bool> |
true |
If true, folders starting with . are ignored |
ignored_directories |
Optional<Array[String]> |
Check here | List of directories to explicitly ignore during analysis |
ignore_dotfiles |
Optional<bool> |
true |
If true files starting with . are ignored |
ignored_files |
Optional<Array[String]> |
Check here | List of specific files to explicitly ignore |
ignore_empty_lines |
Optional<bool> |
true |
If true, empty lines are not counted in the analysis |
excluded_patterns |
Optional<Array[String]> |
Check here | List of VALID regex patterns to exclude from analysis. A line matching ANY of these patterns results in it being discarded from analysis |
tracked |
Optional<Array[Tracked]> |
Check here | List of Tracked structs defining file types/extensions to analyze and their display settings |
Tracked struct fields:
| Field Name | Type | Default Value | Description |
|---|---|---|---|
display |
String |
required | Label or name to display for this tracked language. Must be unique across all Tracked structs |
extensions |
Array[String] |
required | File extensions associated with this tracked language |
color |
Optional<String> |
None |
Color to use when displaying this tracked language. Only used if use_color is set to true. Must be a VALID* hex code |
excluded_patterns |
Optional<Array[String]> |
[] |
List of VALID regex patterns to exclude for this tracked language. A line matching ANY of these patterns results in it being discarded from analysis |
Future
- AWK-compatible output: Add
--awkflag for structured output that can be piped to AWK scripts - Timing controls: Add option to disable timing information in output
Verbose Defaults
ignored_directories
= [
"node_modules",
"target",
"build",
"dist",
"__venv__",
"__pycache__",
]
ignored_files
= [
"package-lock.json",
]
excluded_patterns
= [
# lines starting with //
"^\\s*//",
# lines starting with #
"^\\s*#",
# lines containing only braces, commas, or semicolons
"^\\s*[\\{\\}\\[\\]\\(\\),;]+\\s*$",
]
tracked
[[]]
= "Rust"
= ["rs"]
[[]]
= "Python"
= ["py", "pyi"]
[[]]
= "HTML"
= ["html", "htm"]
[[]]
= "CSS"
= ["css", "scss", "sass", "less"]
[[]]
= "JavaScript"
= ["js", "jsx", "mjs", "cjs"]
[[]]
= "TypeScript"
= ["ts", "tsx"]
[[]]
= "Svelte"
= ["svelte"]
[[]]
= "C"
= ["c", "h"]
[[]]
= "C++"
= ["cpp", "cxx", "cc", "hpp", "hh"]
[[]]
= "C#"
= ["cs"]
[[]]
= "Bash / Shell"
= ["sh", "bash", "bashrc", "bash_profile", "zsh", "zshrc"]
[[]]
= "Java"
= ["java"]
[[]]
= "Jupyter Notebook"
= ["ipynb"]
[[]]
= "Assembly"
= ["asm", "s", "mips"]
[[]]
= "Go"
= ["go"]
[[]]
= "Prisma"
= ["prisma"]
[[]]
= "Kotlin"
= ["kt", "kts"]
[[]]
= "Swift"
= ["swift"]
[[]]
= "Objective-C"
= ["m", "mm"]
[[]]
= "PHP"
= ["php", "phtml"]
[[]]
= "Ruby"
= ["rb", "erb", "gemspec"]
[[]]
= "Perl"
= ["pl", "pm", "t"]
[[]]
= "R"
= ["r", "R"]
[[]]
= "Julia"
= ["jl"]
[[]]
= "Scala"
= ["scala", "sc"]
[[]]
= "Haskell"
= ["hs", "lhs"]
[[]]
= "Elixir"
= ["ex", "exs"]
[[]]
= "Erlang"
= ["erl", "hrl"]
[[]]
= "F#"
= ["fs", "fsi", "fsx"]
[[]]
= "OCaml"
= ["ml", "mli"]
[[]]
= "Clojure"
= ["clj", "cljs", "cljc", "edn"]
[[]]
= "Dart"
= ["dart"]
[[]]
= "Makefile"
= ["mk", "make", "Makefile"]
[[]]
= "Dockerfile"
= ["dockerfile"]
[[]]
= "YAML"
= ["yml", "yaml"]
[[]]
= "JSON"
= ["json", "json5"]
[[]]
= "TOML"
= ["toml"]
[[]]
= "INI / Config"
= ["ini", "cfg", "conf", "env"]
[[]]
= "Markdown"
= ["md", "markdown"]
[[]]
= "LaTeX"
= ["tex", "sty", "cls"]
[[]]
= "SQL"
= ["sql"]
[[]]
= "GraphQL"
= ["graphql", "gql"]
[[]]
= "Vue"
= ["vue"]
[[]]
= "Sass"
= ["sass"]