()
| 43 | ) |
| 44 | |
| 45 | func main() { |
| 46 | topDir, err := func() (string, error) { |
| 47 | ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) |
| 48 | defer cancel() |
| 49 | |
| 50 | if v, err := sh(ctx, "git", "rev-parse", "--show-toplevel"); err == nil { |
| 51 | return strings.TrimSpace(v), nil |
| 52 | } |
| 53 | |
| 54 | return os.Getwd() |
| 55 | }() |
| 56 | if err != nil { |
| 57 | log.Fatal(err) |
| 58 | } |
| 59 | |
| 60 | app := &cli.Command{ |
| 61 | Name: "builder", |
| 62 | Usage: "Do a thing for urfave/cli! (maybe build?)", |
| 63 | Commands: []*cli.Command{ |
| 64 | { |
| 65 | Name: "vet", |
| 66 | Action: topRunAction("go", "vet", "./..."), |
| 67 | }, |
| 68 | { |
| 69 | Name: "test", |
| 70 | Action: TestActionFunc, |
| 71 | }, |
| 72 | { |
| 73 | Name: "gfmrun", |
| 74 | Flags: []cli.Flag{ |
| 75 | &cli.BoolFlag{ |
| 76 | Name: "walk", |
| 77 | Value: false, |
| 78 | Usage: "Walk the specified directory and perform validation on all markdown files", |
| 79 | }, |
| 80 | }, |
| 81 | Action: GfmrunActionFunc, |
| 82 | }, |
| 83 | { |
| 84 | Name: "check-binary-size", |
| 85 | Action: checkBinarySizeActionFunc, |
| 86 | }, |
| 87 | { |
| 88 | Name: "generate", |
| 89 | Action: GenerateActionFunc, |
| 90 | }, |
| 91 | { |
| 92 | Name: "diffcheck", |
| 93 | Action: DiffCheckActionFunc, |
| 94 | }, |
| 95 | { |
| 96 | Name: "ensure-goimports", |
| 97 | Action: EnsureGoimportsActionFunc, |
| 98 | }, |
| 99 | { |
| 100 | Name: "ensure-gfmrun", |
| 101 | Action: EnsureGfmrunActionFunc, |
| 102 | }, |
nothing calls this directly
no test coverage detected