Get rid of global kingpin
This commit is contained in:
parent
1b9e72802d
commit
6df7c96f0f
18
main.go
18
main.go
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user