Skip to content

feat(client): add prune filters for age and length#2494

Open
imsakg wants to merge 1 commit intoatuinsh:mainfrom
imsakg:prune-filters
Open

feat(client): add prune filters for age and length#2494
imsakg wants to merge 1 commit intoatuinsh:mainfrom
imsakg:prune-filters

Conversation

@imsakg
Copy link
Copy Markdown

@imsakg imsakg commented Dec 26, 2024

  • Introduce options to prune history by minimum age and maximum length.
  • Default dry_run to true and allow optional specification.
  • Improve command filtering for efficient pruning.

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

- Introduce options to prune history by minimum age and maximum length.
- Default `dry_run` to true and allow optional specification.
- Improve command filtering for efficient pruning.
@imsakg
Copy link
Copy Markdown
Author

imsakg commented Dec 26, 2024

Example usages:

  • atuin history prune --max-length 200
  • atuin history prune --min-age 86400 --dry-run false

@tessus

This comment was marked as spam.

@imsakg
Copy link
Copy Markdown
Author

imsakg commented Jan 3, 2025

Hey @tessus,

Certainly, I did not get it wrong. Let me clarify my use case and the purpose of this pull request.

Consider a scenario where you are executing a command and frequently changing flags until you identify the correct one. Once you have determined the appropriate flag, you may not wish to retain the other executed commands in your Atuin database, as they contribute to unnecessary bloat.

For example:

  1. my_command -x my_file
  2. my_command -x -y my_file
  3. my_command -x -y -z my_file
  4. my_command -a my_file <-- This is the correct command.

Additionally, there is another use case to consider. Suppose you are executing commands that you intend to use only once. Such commands will also be stored in your Atuin database, and it is likely that you do not wish to keep them.

For instance:

DB_CONNECTION_STRING=aws-some-db-service-some-weird-url-geolocating-tag-bla-bla-bla my_program_that_connecting_to_db query "Hello World"

This pull request allows you to remove those unnecessary commands based on their length or age.

@tessus

This comment was marked as spam.

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.

2 participants