forked from ark-lang/ark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.go
35 lines (27 loc) · 1.3 KB
/
args.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
package main
import "gopkg.in/alecthomas/kingpin.v2"
type inputList []string
func (i *inputList) String() string { return "" }
func (i *inputList) IsCumulative() bool { return true }
func (i *inputList) Set(value string) error {
*i = append(*i, value)
return nil
}
func newInputList(s kingpin.Settings) (target *[]string) {
target = new([]string)
s.SetValue((*inputList)(target))
return
}
var (
app = kingpin.New("ark", "Compiler for the Ark programming language.").Version(VERSION).Author(AUTHOR)
verbose = app.Flag("verbose", "Enable verbose mode.").Short('v').Bool()
buildCom = app.Command("build", "Build an executable.")
buildOutput = buildCom.Flag("output", "Output binary name.").Short('o').Default("main").String()
buildInputs = newInputList(buildCom.Arg("input", "Ark source files."))
buildCodegen = buildCom.Flag("codegen", "Codegen backend to use").Default("llvm").Enum("none", "llvm", "ark")
buildStatic = buildCom.Flag("static", "Pass the -static option to cc.").Bool()
buildRun = buildCom.Flag("run", "Run the executable.").Bool()
docgenCom = app.Command("docgen", "Generate documentation.")
docgenDir = docgenCom.Flag("dir", "Directory to place generated docs in.").Default("docgen").String()
docgenInputs = newInputList(docgenCom.Arg("input", "Ark source files."))
)