Skip to content

Add confirmation prompts for destructive commands: clear, evict, check --fix - #6

Open
shubham-dce wants to merge 1 commit into
cli-05-maintenancefrom
cli-06-confirmation
Open

Add confirmation prompts for destructive commands: clear, evict, check --fix#6
shubham-dce wants to merge 1 commit into
cli-05-maintenancefrom
cli-06-confirmation

Conversation

@shubham-dce

Copy link
Copy Markdown
Owner

Summary

Adds a confirmation prompt for the three destructive commands clear, evict TAG, check --fix, it 'y'(yes) provided then it goes ahead with the opted operation, else aborts.

Changes

  • confirm(prompt) a shared method to be used by all the clear, evict and check methods. It returns true if 'y' or 'yes' opted.
  • -y/--yes passed with commands skips the prompt, this is valid only for the above mentioned destructive commands.
  • check only shows prompt if --fix flag is passed.

Testing

  • Updated the FakeExtraArgs class with a new kwarg yes (by default False) to test the confirmation prompt
  • Updated the existing tests test_clear_removes_all_items, test_evict_removes_items_with_matching_tag to behave as -y/--yes flag is provided.
  • 7 new tests added, all passing successfully. Coverage is at 98.38%

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