atuin icon indicating copy to clipboard operation
atuin copied to clipboard

Add atuin stats --filter-mode

Open drbrain opened this issue 2 years ago • 1 comments

This adds atuin stats --filter-mode which takes the same options as atuin search --filter-mode. It allows filtering atuin stats output.

To accomplish this Database::list() now has an optional range argument and adds a WHERE clause matching Database::range().

Full output:

❯ cargo run --bin atuin -- stats
[▮▮▮▮▮▮▮▮▮▮] 4334 cargo nextest
[▮▮▮▮▮▮▮   ] 3275 git status
[▮▮▮▮▮     ] 2190 cargo run
[▮▮▮▮▮     ] 2190 git diff
[▮▮▮▮      ] 2083 git commit
[▮▮▮▮      ] 1823 c
[▮▮▮       ] 1645 cargo b
[▮▮▮       ] 1482 git switch
[▮▮▮       ] 1406 nvim
[▮▮▮       ] 1386 ls
Total commands:   49595
Unique commands:  14105

Workspace output:

❯ cargo run --bin atuin -- stats --filter-mode workspace
[▮▮▮▮▮▮▮▮▮▮] 35 cargo nextest
[▮▮▮▮▮▮▮▮▮ ] 33 cargo run
[▮▮▮       ] 12 ssh
[▮▮        ] 10 git diff
[▮▮        ]  7 git push
[▮         ]  6 git commit
[▮         ]  6 nvim
[▮         ]  5 date
[▮         ]  5 cargo b
[▮         ]  5 git switch
Total commands:   166
Unique commands:  64

Workspace with date filter:

❯ cargo run --bin atuin -- stats --filter-mode workspace today
[▮▮▮▮▮▮▮▮▮▮] 31 cargo nextest
[▮▮▮       ] 12 cargo run
[▮         ]  5 date
[▮         ]  5 RUST_LOG=debug
[▮         ]  4 git diff
[          ]  2 git commit
[          ]  1 git push
[          ]  1 git status
[          ]  1 rm
Total commands:   62
Unique commands:  18

Checks

  • [x] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • [x] I have checked that there are no existing pull requests for the same thing

drbrain avatar Feb 20 '24 04:02 drbrain

Thank you, looks good. would it be possible to get a rebase?

ellie avatar Mar 01 '24 15:03 ellie