From c8f31c63aff587f41d71e1553941a8a7db1b1fbf Mon Sep 17 00:00:00 2001 From: Tom Fleet Date: Wed, 22 Apr 2026 18:10:33 +0100 Subject: [PATCH] Use `default:` in arg descriptions too, standardising the format --- command.go | 2 +- testdata/snapshots/TestHelp/with_named_arguments.snap.txt | 4 ++-- testdata/snapshots/TestHelp/with_verbosity_count.snap.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/command.go b/command.go index 79beacb..b8adc2e 100644 --- a/command.go +++ b/command.go @@ -579,7 +579,7 @@ func writeArgumentsSection(cmd *Command, s *strings.Builder) error { for _, arg := range cmd.args { line := fmt.Sprintf(" %s\t%s\t%s\t[required]", style.Bold.Text(arg.Name()), arg.Type(), arg.Usage()) if arg.Default() != "" { - line = fmt.Sprintf(" %s\t%s\t%s\t[default %s]", style.Bold.Text(arg.Name()), arg.Type(), arg.Usage(), arg.Default()) + line = fmt.Sprintf(" %s\t%s\t%s\t[default: %s]", style.Bold.Text(arg.Name()), arg.Type(), arg.Usage(), arg.Default()) } fmt.Fprintln(tw, line) diff --git a/testdata/snapshots/TestHelp/with_named_arguments.snap.txt b/testdata/snapshots/TestHelp/with_named_arguments.snap.txt index 4ff021b..1c1ce60 100644 --- a/testdata/snapshots/TestHelp/with_named_arguments.snap.txt +++ b/testdata/snapshots/TestHelp/with_named_arguments.snap.txt @@ -5,8 +5,8 @@ Usage: test [OPTIONS] SRC [DEST] [OTHER] Arguments: src string The file to copy [required] - dest string Destination to copy to [default default.txt] - other int Something else [default 0] + dest string Destination to copy to [default: default.txt] + other int Something else [default: 0] Options: diff --git a/testdata/snapshots/TestHelp/with_verbosity_count.snap.txt b/testdata/snapshots/TestHelp/with_verbosity_count.snap.txt index 51623e7..376e6eb 100644 --- a/testdata/snapshots/TestHelp/with_verbosity_count.snap.txt +++ b/testdata/snapshots/TestHelp/with_verbosity_count.snap.txt @@ -5,7 +5,7 @@ Usage: test [OPTIONS] SRC [DEST] Arguments: src string The file to copy [required] - dest string Destination to copy to [default destination.txt] + dest string Destination to copy to [default: destination.txt] Options: