diff --git a/.gitignore b/.gitignore index c0bf368dbd206c7ed79d3d15fe11e3cb3ebed218..0dd366fe7e80fdba321fac087d803c0909907e13 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ cover.html examples/adder/local/local examples/adder/remote/client/client examples/adder/remote/server/server +coverage.out diff --git a/cli/helptext.go b/cli/helptext.go index 1c5480a35433d46d918bc6046a9595160c54608e..7b54d7f420121afbceaa7d7b2678d3fc2ba0c62a 100644 --- a/cli/helptext.go +++ b/cli/helptext.go @@ -301,7 +301,12 @@ func generateSynopsis(width int, cmd *cmds.Command, path string) string { } } } - appendText("[" + sopt + "]") + + if opt.Type() == cmds.Strings { + appendText("[" + sopt + "]...") + } else { + appendText("[" + sopt + "]") + } } if len(cmd.Arguments) > 0 { appendText("[--]") diff --git a/cli/helptext_test.go b/cli/helptext_test.go index c5f524c81b4f40241b2ab38a5fba47b8839ba0dc..7e13568376a714fe986c295435c561af7b615295 100644 --- a/cli/helptext_test.go +++ b/cli/helptext_test.go @@ -15,6 +15,7 @@ func TestSynopsisGenerator(t *testing.T) { }, Options: []cmds.Option{ cmds.StringOption("opt", "o", "Option"), + cmds.StringsOption("var-opt", "Variadic Option"), }, Helptext: cmds.HelpText{ SynopsisOptionsValues: map[string]string{ @@ -31,6 +32,9 @@ func TestSynopsisGenerator(t *testing.T) { if !strings.Contains(syn, "[--opt=