shellist 0.1.0

Shell history analysis. Parses .bash_history, counts commands, and ranks by frequency.
Documentation
  • Coverage
  • 78.57%
    22 out of 28 items documented11 out of 16 items with examples
  • Size
  • Source code size: 48.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 569.9 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ultraelectronica/shellist
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ultraelectronica

Shellist

Parse .bash_history, count commands, rank by frequency. Library and CLI.

Install

cargo install shellist

CLI

shellist                   # reads ~/.bash_history, prints ranked table
shellist --top 5           # top 5 only
shellist --ignore ls,cd    # exclude ls and cd
shellist --min 3           # only commands used ≥ 3 times
shellist --path ./my_history.txt

Options:

Flag Description
--top N Show top N commands
--ignore X,Y Exclude commands (comma-separated)
--min N Only commands with count ≥ N
--path PATH Read from PATH (default: ~/.bash_history)
--help Print help

Example output:

Rank  Command  Count
----  -------  -----
   1  ls          120
   2  git          95
   3  cd           80

Library

use shellist::{analyze, parse_history, count_commands, rank_commands,
                top_n, filter_commands, filter_by_min_frequency,
                load_history_file, default_history_path};

// Full pipeline
let ranked = analyze("ls\ngit\nls\ncd\ngit\nls");
assert_eq!(ranked, vec![
    ("ls".to_string(), 3),
    ("git".to_string(), 2),
    ("cd".to_string(), 1),
]);

// Step by step
let entries = parse_history("git push\ncd /\ngit commit");
let counts = count_commands(&entries);
let ranked = rank_commands(counts);
let top = top_n(ranked, 2);
let filtered = filter_commands(top, &["cd"]);

// From file
let content = load_history_file("/home/user/.bash_history")?;

Benchmarks

cargo bench

Runs criterion benchmarks on analyze() with 100, 1k, 10k, and 100k history entries. Results are written to target/criterion/ with HTML reports.

To compare against a baseline:

cargo bench -- --save-baseline before
# make changes...
cargo bench -- --baseline before

License

MIT