/
cmd_clean_api.go
52 lines (35 loc) · 890 Bytes
/
cmd_clean_api.go
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fmt"
"github.com/bobziuchkovski/writ"
"github.com/jkomoros/boardgame/boardgame-util/lib/build/api"
)
type cleanAPI struct {
baseSubCommand
}
func (c *cleanAPI) Run(p writ.Path, positional []string) {
if len(positional) > 1 {
c.Base().errAndQuit(c.Name() + " called with more than one positional argument")
}
dir := "."
err := api.Clean(dir)
if err != nil {
c.Base().errAndQuit(err.Error())
}
fmt.Println("Cleaned api folder")
}
func (c *cleanAPI) Name() string {
return "api"
}
func (c *cleanAPI) Description() string {
return "Cleans up an api server folder created by `build api`"
}
func (c *cleanAPI) Usage() string {
return "DIR"
}
func (c *cleanAPI) HelpText() string {
return c.Name() + ` removes the api server folder (binary and code) within
DIR that was created by 'build api'.
If DIR is not provided, defaults to "."
`
}