-
Notifications
You must be signed in to change notification settings - Fork 13
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
Do not show usage error for --all flag #960
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,12 @@ impl RepositoryDeleteCommand { | |
#[async_trait::async_trait(?Send)] | ||
impl Command for RepositoryDeleteCommand { | ||
async fn run(&mut self) -> Result<(), CLIError> { | ||
if self.names.is_empty() && !self.all { | ||
return Err(CLIError::usage_error( | ||
"Specify a repository or use --all flag", | ||
)); | ||
} | ||
|
||
Comment on lines
+49
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use (override) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think we should work through all the variations
I think some of these options are redundant and an error message should be provided for them |
||
let repo_names: Vec<_> = if self.all { | ||
self.remote_repo_reg.get_all_repositories().collect() | ||
} else { | ||
|
@@ -58,9 +64,11 @@ impl Command for RepositoryDeleteCommand { | |
}; | ||
|
||
if repo_names.is_empty() { | ||
return Err(CLIError::usage_error( | ||
"Specify a repository or use --all flag", | ||
)); | ||
eprintln!( | ||
"{}", | ||
console::style("There are no repositories to delete").yellow() | ||
); | ||
return Ok(()); | ||
} | ||
|
||
self.interact.require_confirmation(format!( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: add E2E tests -- Here it would be great to check our errors (output messages)
PS. I'd like to help make these, if you decide to make them, let me know and I'll advise on the best way to approach it