Skip to content

Commit

Permalink
cscli: fix deprecation message for "context delete" (#3078)
Browse files Browse the repository at this point in the history
missing newline, proper return code, same msg as dashboard, test
  • Loading branch information
mmetc authored Jun 11, 2024
1 parent ae58b15 commit c39c9cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/crowdsec-cli/lapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,8 @@ func (cli *cliLapi) newContextDeleteCmd() *cobra.Command {
if filePath == "" {
filePath = "the context file"
}
fmt.Printf("Command 'delete' is deprecated, please manually edit %s.", filePath)

return nil
return fmt.Errorf("command 'delete' has been removed, please manually edit %s", filePath)
},
}

Expand Down
5 changes: 5 additions & 0 deletions test/bats/09_context.bats
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ teardown() {
assert_stderr --partial "while checking console_context_path: stat $CONTEXT_YAML: no such file or directory"
}

@test "csli lapi context delete" {
rune -1 cscli lapi context delete
assert_stderr --partial "command 'delete' has been removed, please manually edit the context file"
}

@test "context file is bad" {
echo "bad yaml" > "$CONTEXT_YAML"
rune -1 "$CROWDSEC" -t
Expand Down

0 comments on commit c39c9cf

Please sign in to comment.