A command-line tool written in Zig that analyzes shell history files to show command usage statistics. It supports multiple shell types including bash, zsh, and fish.
- Supports multiple shell types:
- bash
- zsh
- fish
- Shows command usage frequency
- Displays top 10 most used commands
- Handles different shell history file formats
- Memory-safe implementation
- Zig compiler (version 0.14.0 or later)
- A shell history file (
.bash_history
,.zsh_history
, orfish_history
)
To build the project:
git clone https://github.com/guuzaa/hstats.git
cd hstats
zig build
The executable will be created in zig-out/bin/hstats
.
Basic usage:
hstats --shell <shell_type>
Where <shell_type>
can be:
bash
(default)zsh
fish
Examples:
# Analyze zsh history
hstats --shell zsh
# Analyze fish history
hstats --shell fish
# Show help
hstats --help
The output shows the command usage statistics in the following format:
<count> <command>
For example:
50 zig build
47 zig build test
37 ls
36 git add .
29 exit
To run tests:
zig build test
To run the program with debug output:
zig build run -- --shell zsh
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.