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 "cscli" without arguments #1406

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ It is meant to allow you to manage bans, parsers/scenarios/etc, api and generall
log.Fatalf("failed to make branch hidden : %s", err)
}

if os.Args[1] != "completion" {
if len(os.Args) > 1 && os.Args[1] != "completion" {
cobra.OnInitialize(initConfig)
}

Expand Down
7 changes: 7 additions & 0 deletions tests/bats/01_base.bats
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ declare stderr

#----------

@test "$FILE cscli - usage" {
run -0 cscli
assert_output --partial "Usage:"
assert_output --partial "cscli [command]"
assert_output --partial "Available Commands:"
}

@test "$FILE cscli version" {
run -0 cscli version
assert_output --partial "version:"
Expand Down