File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package main
22
33import (
4- "context"
5-
64 "github.com/sourcegraph/src-cli/internal/clicompat"
75 "github.com/urfave/cli/v3"
86)
@@ -18,12 +16,6 @@ var abcCommand = clicompat.Wrap(&cli.Command{
1816 abcVariablesSetCommand ,
1917 abcVariablesDeleteCommand ,
2018 },
21- Action : func (ctx context.Context , cmd * cli.Command ) error {
22- return cli .ShowSubcommandHelp (cmd )
23- },
2419 }),
2520 },
26- Action : func (ctx context.Context , cmd * cli.Command ) error {
27- return cli .ShowSubcommandHelp (cmd )
28- },
2921})
Original file line number Diff line number Diff line change 11package main
22
33import (
4- "context"
5-
64 "github.com/sourcegraph/src-cli/internal/clicompat"
75 "github.com/urfave/cli/v3"
86)
@@ -32,7 +30,4 @@ var authCommand = clicompat.Wrap(&cli.Command{
3230 Commands : []* cli.Command {
3331 authTokenCommand ,
3432 },
35- Action : func (ctx context.Context , cmd * cli.Command ) error {
36- return cli .ShowSubcommandHelp (cmd )
37- },
3833})
Original file line number Diff line number Diff line change @@ -16,15 +16,17 @@ func Wrap(cmd *cli.Command) *cli.Command {
1616 }
1717
1818 cmd .OnUsageError = OnUsageError
19- cmd .Action = wrapWithHelpOnUsageError (cmd .Action )
19+ if cmd .Action == nil {
20+ cmd .Action = func (ctx context.Context , cmd * cli.Command ) error {
21+ return cli .ShowSubcommandHelp (cmd )
22+ }
23+ } else {
24+ cmd .Action = wrapWithHelpOnUsageError (cmd .Action )
25+ }
2026 return cmd
2127}
2228
2329func wrapWithHelpOnUsageError (action cli.ActionFunc ) cli.ActionFunc {
24- if action == nil {
25- return nil
26- }
27-
2830 return func (ctx context.Context , cmd * cli.Command ) error {
2931 err := action (ctx , cmd )
3032 if err != nil && errors.HasType [* cmderrors.UsageError ](err ) {
You can’t perform that action at this time.
0 commit comments