fix "cscli" without arguments (#1406)

This commit is contained in:
mmetc 2022-03-31 16:50:38 +02:00 committed by GitHub
parent cea793fc3a
commit b202e387cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -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)
}

View file

@ -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:"