Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache destroy command #50

Closed
mscottford opened this issue Apr 28, 2022 · 1 comment · Fixed by #81
Closed

Add cache destroy command #50

mscottford opened this issue Apr 28, 2022 · 1 comment · Fixed by #81
Labels
enhancement New feature or request
Milestone

Comments

@mscottford
Copy link
Member

mscottford commented Apr 28, 2022

cache destroy

Used to completely remove the cache directory and all of its contents, including the cache database.

freshli [global options] cache destroy [command options]

What this command does?

Deletes the cache directory and all files that it contains.

Global Otions

  • --cache-dir <path>
    • the location where the freshli command will write temporary files as part of it’s processing
    • default value: $HOME/.freshli

Command Options

  • --force
    • Skips the prompt confirming that operation should proceed
@mscottford mscottford added the enhancement New feature or request label Apr 29, 2022
@CodeMouse92 CodeMouse92 self-assigned this May 17, 2022
@CodeMouse92
Copy link
Contributor

CodeMouse92 commented May 17, 2022

(d2+f2)*r2=8 energy

  • Unit and acceptance tests for cache destroy
  • destroy subcommand (unprompted without --force)
  • Spike: does System.CommandLine have "flags", or only boolean options? (1 pomodoro)
  • --force flag/option
  • Spike: does System.CommandLine have a built-in y/N prompt? (1 pomodoro)
  • Add y/N prompt to destroy subcommand
  • --force flag/option implementation in destroy subcommand

Notes:
Deleting files and directories must be portable.

Possible unexpected deletion risk if --cache-dir is pointed to /home/user/ or some other directory containing unrelated files. To prevent this:

  1. Maintain a list of names of known cache files.
  2. If no known cache files are present in cache-dir, fail with warning message.
  3. Delete known cache files in cache-dir.
  4. Check if cache-dir is empty. If so, delete it; else if not, warn and do not delete directory.

There should be no way around this behavior, even with --force.

@CodeMouse92 CodeMouse92 removed their assignment Jun 7, 2022
Repository owner moved this from To Do to Done in Freshli Jun 14, 2022
@mscottford mscottford added this to the v0.5.0 milestone Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants