Recognize "--help" as valid global option

This commit is contained in:
Marcin Kulik
2014-12-17 11:39:30 +01:00
parent 43c98f7eaf
commit 8db0874a34
2 changed files with 2 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ func parseArgs(args []string) (string, []string) {
command = args[0]
args = args[1:]
if command == "-h" {
if command == "-h" || command == "--help" {
command = "help"
}
}

View File

@@ -44,6 +44,7 @@ func TestCLI_Run(t *testing.T) {
}{
{[]string{}, 1, helpCmd},
{[]string{"-h"}, 0, helpCmd},
{[]string{"--help"}, 0, helpCmd},
{[]string{"wow", "-v"}, 0, verCmd},
{[]string{"version"}, 0, verCmd},
{[]string{"foo"}, 0, fooCmd},