Fix short flags.

This commit is contained in:
Alec Thomas
2018-06-06 19:07:01 +10:00
parent 9498118314
commit 9cc1872297
2 changed files with 21 additions and 9 deletions
+12
View File
@@ -344,3 +344,15 @@ func TestHooks(t *testing.T) {
})
}
}
func TestShort(t *testing.T) {
var cli struct {
Bool bool `short:"b"`
String string `short:"s"`
}
app := mustNew(t, &cli)
_, err := app.Parse([]string{"-b", "-shello"})
require.NoError(t, err)
require.True(t, cli.Bool)
require.Equal(t, "hello", cli.String)
}