Update error message for missing required flags (#580)

Make it so that first letter is not capitalized and rephrase
to remove "have/has".
This commit is contained in:
Nick Miyake 2017-11-19 01:22:51 -08:00 committed by Albert Nigmatzianov
parent 34ceca591b
commit 19e54c4a2b
2 changed files with 3 additions and 3 deletions

View file

@ -827,7 +827,7 @@ func (c *Command) validateRequiredFlags() error {
})
if len(missingFlagNames) > 0 {
return fmt.Errorf(`Required flag(s) "%s" have/has not been set`, strings.Join(missingFlagNames, `", "`))
return fmt.Errorf(`required flag(s) "%s" not set`, strings.Join(missingFlagNames, `", "`))
}
return nil
}

View file

@ -681,7 +681,7 @@ func TestRequiredFlags(t *testing.T) {
c.MarkFlagRequired("foo2")
c.Flags().String("bar", "", "")
expected := fmt.Sprintf("Required flag(s) %q, %q have/has not been set", "foo1", "foo2")
expected := fmt.Sprintf("required flag(s) %q, %q not set", "foo1", "foo2")
_, err := executeCommand(c)
got := err.Error()
@ -708,7 +708,7 @@ func TestPersistentRequiredFlags(t *testing.T) {
parent.AddCommand(child)
expected := fmt.Sprintf("Required flag(s) %q, %q, %q, %q have/has not been set", "bar1", "bar2", "foo1", "foo2")
expected := fmt.Sprintf("required flag(s) %q, %q, %q, %q not set", "bar1", "bar2", "foo1", "foo2")
_, err := executeCommand(parent, "child")
if err.Error() != expected {