Tokui is a high-performance, cross-platform command-line tool for visualizing and exploring your code statistics. It integrates with the powerful code statistics engine tokei to present code line count metrics through a responsive, keyboard-driven Terminal User Interface (TUI), helping you to quickly analyze code composition and understand your project's structure.
Project Origin
This project is a fork of the excellent disk space analyzer noxdir, and was heavily modified and refactored by a Large Language Model (LLM), transforming its functionality from a disk analyzer into a code statistics visualizer.
- Interactive Terminal UI: Navigate through your project's directory structure with ease using your keyboard.
- Deep Tokei Integration: Leverages the powerful analysis capabilities of
tokei
for accurate code statistics. - Detailed Data Analysis: Displays lines of code, comments, blanks, and total lines, categorized by language.
- File Preview: Press
Enter
on any file to instantly preview its contents in a scrollable overlay window. - Visual Charts: Toggle a pie chart with
Ctrl+w
to intuitively visualize the proportion of each language. - Dynamic Filtering and Searching:
- Quickly search by file name (
/
). - Filter statistics by a specific language (
Tab
), or select multiple languages for combined filtering (Ctrl+L
). - Flexible language selection overlay: Press
Ctrl+L
to open a multi-select menu for languages.
- Quickly search by file name (
- High-Performance & Lightweight: Written in Go, it compiles to a single, installation-free binary.
- Privacy-Focused: Runs entirely locally. No telemetry or data uploads, ever.
A clean table showing code statistics for files and subdirectories in the current path.
ββ π Code Statistics ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ICON NAME LANGUAGES CODE TOTAL % β
β π internal Go, ... 15,021 18,345 65.3% β
β π» main.go Go 850 1,010 3.6% β
β π README.md Markdown 120 150 0.5% β
β ... β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Quickly select one or more languages for combined filtering.
Use Space
to toggle selection, Enter
to confirm, and Esc
to cancel.
βββββββββββββ Select Languages βββββββββββββββββ
β Space: toggle, Enter: confirm, Esc: cancel β
β β [x] Go β
β [ ] Python β
β [x] Markdown β
β ... β
ββββββββββββββββββββββββββββββββββββββββββββββββ
Visually represents the distribution of programming languages in the project.
βββββββββββββββββββββββββββββββββββββββββββββββββ
β Language Distribution β
β βββββββ β
β βββββββββββ β Go: 18,500 lines β
β βββββββββββ β YAML: 2,300 lines β
β βββββββ β Markdown: 450 lines β
β βββ ... β
βββββββββββββββββββββββββββββββββββββββββββββββββ
Instantly preview file contents in a scrollable overlay window.
βββββββββββββββββββββ File Preview: main.go ββββββββββββββββββββββββββ
β β
β package main β
β β
β import ( β
β "fmt" β
β "os" β
β ) β
β β
β func main() { β
β fmt.Println("Hello, World!") β
β } β
β β
β Press 'q' to close, β/β/j/k to scroll, PgUp/PgDn for page 15/23 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Tokui has a strong dependency on tokei
. Before using, please ensure you have tokei
installed and added to your system's PATH
environment variable.
- Install
tokei
: https://github.com/XAMPPRocky/tokei#installation
You can download the latest pre-compiled version from the Releases page. Unzip the file and it's ready to useβno extra installation required.
# Clone the repository
git clone https://github.com/zdyxry/tokui.git
cd tokui
# Build
make build
# Run
./bin/tokui
Tokui supports two modes of operation:
In this mode, Tokui will automatically call the tokei
command to analyze the specified directory.
# Analyze the current directory
tokui
# Analyze a specific directory
tokui /path/to/your/project
You can first run tokei
manually and pipe its json
output to tokui
. This is useful when you need to use more complex arguments for tokei
.
# Analyze the current directory
tokei -o json . | tokui
# Analyze a specific directory and exclude node_modules
tokei -o json --exclude node_modules . | tokui
Tokui currently supports the following command-line flags:
Usage:
tokui [directory] [flags]
Flags:
-r, --root string Specify the root directory to analyze. Defaults to the current directory ".".
Example: tokui --root="/path/to/project"
-h, --help Show help information
Key | Action |
---|---|
β / k |
Move cursor up |
β / j |
Move cursor down |
Enter |
Enter selected directory / Preview file content |
Backspace |
Go back to the parent directory |
Tab |
Cycle through language filters (All, Go, Python, ...) |
Ctrl +L |
Open multi-language selection overlay (multi-select language filter) |
/ |
Activate/input file name filter (press Esc to exit filter mode) |
Ctrl +w |
Show/hide language distribution pie chart |
? |
Show/hide full help |
q / Ctrl +c |
Quit the application / Close file preview |
When previewing a file, additional keyboard shortcuts are available:
Key | Action |
---|---|
β / k |
Scroll up |
β / j |
Scroll down |
PgUp |
Page up |
PgDn |
Page down |
q / Esc |
Close file preview and return to directory view |
Pull Requests are welcome! If you'd like to add new features or report bugs, please open an issue first to discuss your ideas.