diff --git a/command_test.go b/command_test.go index f346294339..f88fea9d05 100644 --- a/command_test.go +++ b/command_test.go @@ -2174,7 +2174,7 @@ func TestCommand_Run_SubcommandFullPath(t *testing.T) { outString := out.String() require.Contains(t, outString, "foo bar - does bar things") - require.Contains(t, outString, "foo bar [command [command options]] [arguments...]") + require.Contains(t, outString, "foo bar [options] [arguments...]") } func TestCommand_Run_Help(t *testing.T) { diff --git a/docs/migrate-v2-to-v3.md b/docs/migrate-v2-to-v3.md index ad2c566d17..1d70b5fdff 100644 --- a/docs/migrate-v2-to-v3.md +++ b/docs/migrate-v2-to-v3.md @@ -379,6 +379,25 @@ Similar messages would be shown for other funcs. } ``` +## PathFlag + +=== "v2" + + ```go + &cli.PathFlag{ + Name: "foo", + } + ``` + +=== "v3" + + ```go + &cli.StringFlag{ + Name: "foo", + TakesFiles: true, + } + ``` + ## Authors === "v2" diff --git a/examples_test.go b/examples_test.go index c86b89657f..727b58359d 100644 --- a/examples_test.go +++ b/examples_test.go @@ -232,7 +232,7 @@ func ExampleCommand_Run_subcommandNoAction() { // greet describeit - use it to see a description // // USAGE: - // greet describeit [command [command options]] [arguments...] + // greet describeit [options] [arguments...] // // DESCRIPTION: // This is how we describe describeit the function diff --git a/godoc-current.txt b/godoc-current.txt index 93018fd5fc..80d4aa0c5d 100644 --- a/godoc-current.txt +++ b/godoc-current.txt @@ -135,7 +135,7 @@ var SubcommandHelpTemplate = `NAME: {{template "helpNameTemplate" .}} USAGE: - {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleCommands}} [command [command options]] {{end}}{{if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{if .Arguments}} [arguments...]{{end}}{{end}}{{end}}{{if .Category}} + {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleCommands}} [command [command options]]{{end}}{{if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{if .Arguments}} [arguments...]{{end}}{{end}}{{end}}{{if .Category}} CATEGORY: {{.Category}}{{end}}{{if .Description}} diff --git a/help_test.go b/help_test.go index 096fee7b8b..47ae238a50 100644 --- a/help_test.go +++ b/help_test.go @@ -713,7 +713,7 @@ func TestShowSubcommandHelp_GlobalOptions(t *testing.T) { foo frobbly USAGE: - foo frobbly [command [command options]] + foo frobbly [options] OPTIONS: --bar string diff --git a/template.go b/template.go index 1c0317858a..29c8e8c71e 100644 --- a/template.go +++ b/template.go @@ -3,7 +3,7 @@ package cli var ( helpNameTemplate = `{{$v := offset .FullName 6}}{{wrap .FullName 3}}{{if .Usage}} - {{wrap .Usage $v}}{{end}}` argsTemplate = `{{if .Arguments}}{{range .Arguments}}{{.Usage}}{{end}}{{end}}` - usageTemplate = `{{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleFlags}} [command [command options]]{{end}}{{if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{if .Arguments}} {{template "argsTemplate" .}}{{end}}{{end}}{{end}}` + usageTemplate = `{{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleFlags}} [options]{{end}}{{if .VisibleCommands}} [command [command options]]{{end}}{{if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{if .Arguments}} {{template "argsTemplate" .}}{{end}}{{end}}{{end}}` descriptionTemplate = `{{wrap .Description 3}}` authorsTemplate = `{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}: {{range $index, $author := .Authors}}{{if $index}} @@ -95,7 +95,7 @@ var SubcommandHelpTemplate = `NAME: {{template "helpNameTemplate" .}} USAGE: - {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleCommands}} [command [command options]] {{end}}{{if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{if .Arguments}} [arguments...]{{end}}{{end}}{{end}}{{if .Category}} + {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleCommands}} [command [command options]]{{end}}{{if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{if .Arguments}} [arguments...]{{end}}{{end}}{{end}}{{if .Category}} CATEGORY: {{.Category}}{{end}}{{if .Description}}