MCPcopy Create free account
hub / github.com/Songmu/make2help / Run

Method Run

cli.go:29–54  ·  view source on GitHub ↗

Run the make2help

(argv []string)

Source from the content-addressed store, hash-verified

27
28// Run the make2help
29func (cli *CLI) Run(argv []string) int {
30 argv, isHelp, all := parseFlags(argv)
31 if isHelp {
32 fmt.Fprintln(cli.ErrStream, help())
33 return exitCodeOK
34 }
35 if len(argv) < 1 {
36 argv = []string{"Makefile"}
37 }
38 colorful := false
39 if w, ok := cli.OutStream.(*os.File); ok {
40 colorful = isatty.IsTerminal(w.Fd())
41 cli.OutStream = colorable.NewColorable(w)
42 }
43 r := rules{}
44 for _, f := range argv {
45 tmpRule, err := scan(f)
46 if err != nil {
47 fmt.Fprintln(cli.ErrStream, err)
48 return exitCodeErr
49 }
50 r = r.merge(tmpRule)
51 }
52 fmt.Fprint(cli.OutStream, r.string(all, colorful))
53 return exitCodeOK
54}
55
56var (
57 helpReg = regexp.MustCompile(`^--?h(?:elp)?$`)

Callers 1

mainFunction · 0.80

Calls 5

mergeMethod · 0.95
stringMethod · 0.95
parseFlagsFunction · 0.85
helpFunction · 0.85
scanFunction · 0.85

Tested by

no test coverage detected