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

Fix/enhancing delete 486 #880

Merged
merged 9 commits into from
Dec 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enhance object delete
add parameter check
  • Loading branch information
jiangshaohua committed Dec 23, 2022
commit c3b106a77258b4d72cb419232352a05db7fd71c4
17 changes: 17 additions & 0 deletions cmd/client/command/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ func deleteObjectCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "delete",
Short: "Delete an object from a yaml file or name",
Args: func(cmd *cobra.Command, args []string) error {

coderabbit214 marked this conversation as resolved.
Show resolved Hide resolved
if allFlag {
if len(specFile) != 0 {
return errors.New("--all and --file cannot be used together")
}
if len(args) != 0 {
return errors.New("--all and <object_name> cannot be used together")
}
}

if len(args) != 0 && len(specFile) != 0 {
return errors.New("--file and <object_name> cannot be used together")
}

return nil
},
Run: func(cmd *cobra.Command, args []string) {

coderabbit214 marked this conversation as resolved.
Show resolved Hide resolved
if allFlag {
Expand Down