File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ func migratedRootCommand() *cli.Command {
5151 commands = append (commands , migratedCommands [name ])
5252 }
5353
54- return clicompat .WrapRoot (& cli.Command {
54+ return clicompat .Wrap (& cli.Command {
5555 Name : "src" ,
5656 HideVersion : true ,
5757 Commands : commands ,
Original file line number Diff line number Diff line change @@ -17,20 +17,21 @@ import (
1717 "github.com/urfave/cli/v3"
1818)
1919
20- const versionExamples = `Examples:
20+ const versionExamples = `
21+ Display and compare the src-cli version against the recommended version for your instance
2122
22- Get the src-cli version and the Sourcegraph instance's recommended version :
23+ Examples :
2324
24- $ src version
25+ Get the src-cli version and the Sourcegraph instance's recommended version:
26+
27+ $ src version
2528`
2629
2730var versionCommand = clicompat .Wrap (& cli.Command {
2831 Name : "version" ,
29- Usage : "display and compare the src-cli version against the recommended version for your instance" ,
3032 UsageText : "src version [options]" ,
3133 OnUsageError : clicompat .OnUsageError ,
32- Description : `
33- ` + versionExamples ,
34+ Description : versionExamples ,
3435 Flags : clicompat .WithAPIFlags (
3536 & cli.BoolFlag {
3637 Name : "client-only" ,
Original file line number Diff line number Diff line change @@ -9,43 +9,12 @@ import (
99 "github.com/urfave/cli/v3"
1010)
1111
12- // LegacyCommandHelpTemplate formats leaf command help in a style closer to the
13- // existing flag.FlagSet-based help output.
14- const LegacyCommandHelpTemplate = `Usage of '{{.FullName}}':
15- {{range .VisibleFlags}} {{printf " -%s\n\t\t\t\t%s\n" .Name .Usage}}{{end}}{{if .Description}}
16- {{trim .Description}}
17- {{end}}
18- `
19-
20- // LegacyRootCommandHelpTemplate formats root command help while preserving a
21- // command's UsageText when it is provided.
22- const LegacyRootCommandHelpTemplate = `{{if .UsageText}}{{trim .UsageText}}
23- {{else}}Usage of '{{.FullName}}':
24- {{end}}{{if .VisibleFlags}}{{range .VisibleFlags}}{{println .}}{{end}}{{end}}{{if .VisibleCommands}}
25- {{range .VisibleCommands}}{{printf "\t%s\t%s\n" .Name .Usage}}{{end}}{{end}}{{if .Description}}
26- {{trim .Description}}
27- {{end}}
28- `
29-
3012// Wrap sets common options on a sub commands to ensure consistency for help and error handling
3113func Wrap (cmd * cli.Command ) * cli.Command {
3214 if cmd == nil {
3315 return nil
3416 }
35-
36- cmd .CustomHelpTemplate = LegacyCommandHelpTemplate
37- cmd .OnUsageError = OnUsageError
38- cmd .Action = wrapUsageAction (cmd .Action )
39- return cmd
40- }
41-
42- // WrapRoot sets common options on a root command to ensure consistency for help and error handling
43- func WrapRoot (cmd * cli.Command ) * cli.Command {
44- if cmd == nil {
45- return nil
46- }
47-
48- cmd .CustomRootCommandHelpTemplate = LegacyRootCommandHelpTemplate
17+
4918 cmd .OnUsageError = OnUsageError
5019 cmd .Action = wrapUsageAction (cmd .Action )
5120 return cmd
You can’t perform that action at this time.
0 commit comments