Skip to content

Deploy: correctness, HISTTIMEFORMAT, dedup, refactor, and bug fixes - #5

Merged
ultraelectronica merged 17 commits into
masterfrom
versionF
Jul 18, 2026
Merged

ultraelectronica merged 17 commits into
masterfrom
versionF

Conversation

@ultraelectronica

Copy link
Copy Markdown
Owner

Summary

Deploys 17 commits from versionF to master covering all gap-analysis remediation work.

Phases

  • Phase 1 — Correctness fixes: case-insensitive --grep, date validation via civil round-trip (rejects Feb 30 etc.), home_dir() returns Option instead of panicking, load_history_file accepts AsRef<Path>, --since/--until no-timestamp hint, --help stdout (not stderr), UTC bucketing noted in docs.
  • Phase 2 — Bash HISTTIMEFORMAT: DefaultHistoryParser now detects #<digits> lines and attaches timestamps to the following command. 4 new tests.
  • Phase 3-5 — Doc drift + dedup + naming/consistency:
    • Shared bar_len/BAR_MAX in output/mod.rs; zsh prefix detection delegates to parse_zsh_extended; fish - cmd:/cmd: collapsed; removed redundant HistoryEntry::from_parts and default_history_path_for.
    • Added BashHistoryParser type alias; unified --no-default-ignore wording; reordered completions.rs FLAGS to match help; count_commands_at_depth fast path reuses entry.command for depth=1.
    • README/man note --grep is case-insensitive; --trend-bucket daily|weekly|monthly aliases documented; misleading date.rs test comment fixed.
  • Phase 6 — Refactor: run() split into execute() + core_pipeline() for testability; completions doc comment updated to drop the false "kept in sync" claim.
  • Phase 7 — Library: Added parse_with_detected() convenience function that auto-detects shell format and parses, with a doc test.

Bug fixes found during real-data testing

  1. Fish parser didn't unescape \\n — multi-line fish commands stored newlines as \n escapes; the parser treated them as literal text, producing phantom commands like \nmv. Added unescape_fish() (\\\\\ → \\\\, \\n → newline). 2 new tests.
  2. Duplicate error messages — --since/--until/--trend empty cases printed both a specific message AND the generic "no commands to show from {source}". Fixed core_pipeline to return was_empty = false when a specific message was already printed.

Verification

  • All 139 tests pass (115 unit + 4 integration + 20 doc).
  • Zero clippy warnings.
  • Tested end-to-end on real history files (~/.bash_history, ~/.local/share/fish/fish_history with 2000+ entries): default run, --depth 2, --grep, --json, --csv, --stats, --trend (day/week/month), --since/--until, --output, --man, --completions, stdin pipe, unknown flag, bad date, bad regex.
  • Post-fix: mv correctly shows count 5 (was scattered as \nmv phantoms); date/trend empty cases print exactly one message.

Commits (17)

dfbf704 Document --grep and --trend help text improvements
c9f2c60 Improve date validation to reject nonexistent calendar dates
42c72b4 Return `Option` from `default_history_path` and `home_dir`
7bebc02 Add type alias and parse function for shell autodetection
01feb9a Clarify documentation and add case-insensitive grep test
75fe857 Refactor main parsing and extract core pipeline function
32599c7 Reorder flag list and fix `--no-default-ignore` description
b9fbe0d Make `parse_zsh_extended` accessible within crate
f6a5611 Unescape escape sequences in fish history parser
a948821 Parse bash HISTTIMEFORMAT timestamp lines
d1c2105 Use shared `bar_len` function for consistent bar calculation
4aeff09 Use bar_len helper in format_table
4251733 Add bar_len function to compute proportional bar lengths
964a6ec Remove unused `from_parts` method
3accc57 Remove unused re-export of `default_history_path_for`
7666bef Accept AsRef<Path> in file loader and return Optional default path
0e5d0fa Add early return for depth 1 in command counter

Remove unused `default_history_path_for` export and add
`BashHistoryParser` type alias for naming consistency. Implement
`parse_with_detected` function that detects shell format and dispatches
to the appropriate parser.
Update `default_history_path` to return `Option<PathBuf>` instead of
panicking when `HOME` is unset.  Change `home_dir` to return
`Option<PathBuf>` accordingly.

Delegate zsh extended history detection to the parser module.
@ultraelectronica
ultraelectronica merged commit 6547713 into master Jul 18, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant