Merge pull request from rhatdan/args

Report error when arguments given to crio command
This commit is contained in:
Daniel J Walsh 2017-11-01 08:03:18 -04:00 committed by GitHub
commit dce6f3c2ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -409,6 +409,16 @@ func main() {
}() }()
} }
args := c.Args()
if len(args) > 0 {
for _, command := range app.Commands {
if args[0] == command.Name {
break
}
}
return fmt.Errorf("command %q not supported", args[0])
}
config := c.App.Metadata["config"].(*server.Config) config := c.App.Metadata["config"].(*server.Config)
if !config.SELinux { if !config.SELinux {

12
test/command.bats Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bats
load helpers
@test "crio commands" {
run ${CRIO_BINARY} --config /dev/null config > /dev/null
echo "$output"
[ "$status" -eq 0 ]
run ${CRIO_BINARY} badoption > /dev/null
echo "$output"
[ "$status" -ne 0 ]
}