-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.go
51 lines (41 loc) · 885 Bytes
/
main.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
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
// global flags
var outputType string
var RootCmd = &cobra.Command{
Use: "claw",
Short: "Command Line Law",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
},
}
var newCmd = &cobra.Command{
Use: "new",
Short: "New Contract",
RunE: newContract,
}
var compileCmd = &cobra.Command{
Use: "compile",
Short: "Compile into readable contract",
RunE: compileContract,
}
var reviseCmd = &cobra.Command{
Use: "revise",
Short: "Hash modifications to params and template",
RunE: reviseContract,
}
func init() {
compileCmd.Flags().StringVar(&outputType, "output", "md", "Output type: md | html | pdf")
RootCmd.AddCommand(newCmd)
RootCmd.AddCommand(compileCmd)
RootCmd.AddCommand(reviseCmd)
}
func main() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}