1
0
Fork 0

Get rid of global kingpin

timestamps
dump_stack() 2018-10-27 08:14:10 +00:00
parent 1b9e72802d
commit 6df7c96f0f
1 changed files with 13 additions and 5 deletions

18
main.go
View File

@ -429,17 +429,25 @@ func pewHandler(workPath, kcfgPath string) (err error) {
}
func main() {
pathFlag := kingpin.Flag("path", "Path to work directory")
app := kingpin.New(
"out-of-tree",
"kernel {module, exploit} development tool",
)
app.Author("Mikhail Klementev <jollheef@riseup.net>")
app.Version("0.1.0")
pathFlag := app.Flag("path", "Path to work directory")
path := pathFlag.Default(".").ExistingDir()
kcfgFlag := kingpin.Flag("kernels", "Path to kernels config")
kcfgFlag := app.Flag("kernels", "Path to kernels config")
kcfg := kcfgFlag.Envar("OUT_OF_TREE_KCFG").Required().ExistingFile()
kingpin.Command("pew", "Build, run and test module/exploit")
pewCommand := app.Command("pew", "Build, run and test module/exploit")
var err error
switch kingpin.Parse() {
case "pew":
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case pewCommand.FullCommand():
err = pewHandler(*path, *kcfg)
}