Skip to content

add 'ignored_commands' option to stats#1722

Merged
ellie merged 1 commit into
atuinsh:mainfrom
drmorr0:drmorr/ignore-commands
Feb 15, 2024
Merged

add 'ignored_commands' option to stats#1722
ellie merged 1 commit into
atuinsh:mainfrom
drmorr0:drmorr/ignore-commands

Conversation

@drmorr0
Copy link
Copy Markdown
Contributor

@drmorr0 drmorr0 commented Feb 14, 2024

This resolves #1714.

I add a ignored_commands option to stats so that common commands that you don't want showing up in stats can be skipped.

  • I am unsure what the default for this option should be: I left it empty so as to keep it consistent with existing behaviour. Happy to change that if you want.
  • I added a test for this, which required updating the return signature for compute_stats -- I think in the long run the way to test this is by splitting out compute_stats from the function that prints the results, but I thought that might be too much for this PR. Happy to take a stab at this if you disagree.

Output on my machine, using ignored_commands = ["cd", "vi", "ls"]:

(before)

> target/release/atuin stats
[▮▮▮▮▮▮▮▮▮▮] 903 cd
[▮▮▮▮▮▮▮▮▮ ] 874 vi
[▮▮▮▮▮▮    ] 619 ls
[▮▮        ] 199 kcgp
[▮         ] 166 git stat
[▮         ] 159 kcl
[▮         ] 141 kcapp
[▮         ] 131 kcrm
[▮         ] 131 git co
[▮         ] 119 kcg
Total commands:   6747
Unique commands:  1933

(after)

> target/release/atuin stats
[▮▮▮▮▮▮▮▮▮▮] 199 kcgp
[▮▮▮▮▮▮▮▮  ] 166 git stat
[▮▮▮▮▮▮▮   ] 159 kcl
[▮▮▮▮▮▮▮   ] 141 kcapp
[▮▮▮▮▮▮    ] 131 git co
[▮▮▮▮▮▮    ] 131 kcrm
[▮▮▮▮▮     ] 119 kcg
[▮▮▮▮▮     ] 110 kns
[▮▮▮▮▮     ] 109 git amend
[▮▮▮▮▮     ] 107 rm
Total commands:   4352
Unique commands:  1457

Checks

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

Comment thread atuin-client/src/history.rs Outdated
@drmorr0 drmorr0 force-pushed the drmorr/ignore-commands branch from 6db0f58 to 1b84e40 Compare February 14, 2024 17:52
Copy link
Copy Markdown
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks

@ellie ellie merged commit f8d01ee into atuinsh:main Feb 15, 2024
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.

ignore_commands option for stats

2 participants