File: cmd.go

package info (click to toggle)
gotestsum 1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,060 kB
  • sloc: sh: 89; makefile: 16
file content (33 lines) | stat: -rw-r--r-- 626 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package tool

import (
	"fmt"
	"os"

	"gotest.tools/gotestsum/cmd"
	"gotest.tools/gotestsum/cmd/tool/slowest"
)

// Run one of the tool commands.
func Run(name string, args []string) error {
	next, rest := cmd.Next(args)
	switch next {
	case "":
		fmt.Println(usage(name))
		return nil
	case "slowest":
		return slowest.Run(name+" "+next, rest)
	default:
		fmt.Fprintln(os.Stderr, usage(name))
		return fmt.Errorf("invalid command: %v %v", name, next)
	}
}

func usage(name string) string {
	return fmt.Sprintf(`Usage: %s COMMAND [flags]

Commands: slowest

Use '%s COMMAND --help' for command specific help.
`, name, name)
}