Correctly print the unknown command name

by now, if someone calls: `program --validflag unknowncommand` the
output will be:

```
Error: unknown command "--validflag"
Run 'program help' for usage.
```

This patch strips out flags so the unknown command is printed:

```
Error: unknown command "unknowncommand"
Run 'program help' for usage.
```
This commit is contained in:
Simone Gotti
2015-06-22 10:14:37 +02:00
parent 312092086b
commit fb86c5c559
2 changed files with 6 additions and 1 deletions

View File

@ -755,6 +755,11 @@ func TestRootUnknownCommand(t *testing.T) {
if r.Output != s {
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
}
r = noRRSetupTest("--strtwo=a bogus")
if r.Output != s {
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
}
}
func TestFlagsBeforeCommand(t *testing.T) {