MCPcopy
hub / github.com/benbjohnson/wtf / Run

Function Run

cmd/wtf/main.go:55–72  ·  view source on GitHub ↗

Run executes the main program.

(ctx context.Context, args []string)

Source from the content-addressed store, hash-verified

53
54// Run executes the main program.
55func Run(ctx context.Context, args []string) error {
56 // Shift off subcommand from the argument list, if available.
57 var cmd string
58 if len(args) > 0 {
59 cmd, args = args[0], args[1:]
60 }
61
62 // Delegate subcommands to their own Run() methods.
63 switch cmd {
64 case "dial":
65 return (&DialCommand{}).Run(ctx, args)
66 case "", "-h", "help":
67 usage()
68 return flag.ErrHelp
69 default:
70 return fmt.Errorf("wtf %s: unknown command", cmd)
71 }
72}
73
74// usage prints the top-level CLI usage message.
75func usage() {

Callers 1

mainFunction · 0.85

Calls 2

usageFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected