1
0

Refactor argument parsing

This commit is contained in:
2018-10-27 07:48:06 +00:00
parent 672a8e6735
commit 1b9e72802d
2 changed files with 9 additions and 8 deletions

15
main.go
View File

@ -429,17 +429,18 @@ func pewHandler(workPath, kcfgPath string) (err error) {
}
func main() {
pewCommand := kingpin.Command("pew", "Build, run and test module/exploit")
path := pewCommand.Arg(
"path", "Path to work directory").Default(".").ExistingDir()
kernelsConfig := pewCommand.Flag(
"kernels-config", "Path to kernels config").Envar(
"OUT_OF_TREE_KERNELS_CONFIG").Required().ExistingFile()
pathFlag := kingpin.Flag("path", "Path to work directory")
path := pathFlag.Default(".").ExistingDir()
kcfgFlag := kingpin.Flag("kernels", "Path to kernels config")
kcfg := kcfgFlag.Envar("OUT_OF_TREE_KCFG").Required().ExistingFile()
kingpin.Command("pew", "Build, run and test module/exploit")
var err error
switch kingpin.Parse() {
case "pew":
err = pewHandler(*path, *kernelsConfig)
err = pewHandler(*path, *kcfg)
}
if err != nil {