Move kernel command to another file
This commit is contained in:
parent
ce7fce49f5
commit
cc3f536c62
22
kernel.go
Normal file
22
kernel.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2018 Mikhail Klementev. All rights reserved.
|
||||||
|
// Use of this source code is governed by a AGPLv3 license
|
||||||
|
// (or later) that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/jollheef/out-of-tree/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func kernelListHandler(kcfg config.KernelConfig) (err error) {
|
||||||
|
if len(kcfg.Kernels) == 0 {
|
||||||
|
return errors.New("No kernels found")
|
||||||
|
}
|
||||||
|
for _, k := range kcfg.Kernels {
|
||||||
|
fmt.Println(k.DistroType, k.DistroRelease, k.KernelRelease)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
10
main.go
10
main.go
@ -5,7 +5,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
@ -15,14 +14,6 @@ import (
|
|||||||
"github.com/jollheef/out-of-tree/config"
|
"github.com/jollheef/out-of-tree/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func kernelListHandler(kcfg config.KernelConfig) (err error) {
|
|
||||||
for _, kernel := range kcfg.Kernels {
|
|
||||||
fmt.Println(kernel.DistroType, kernel.DistroRelease,
|
|
||||||
kernel.KernelRelease)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := kingpin.New(
|
app := kingpin.New(
|
||||||
"out-of-tree",
|
"out-of-tree",
|
||||||
@ -50,7 +41,6 @@ func main() {
|
|||||||
|
|
||||||
dockerTimeoutFlag := app.Flag("docker-timeout", "Timeout for docker")
|
dockerTimeoutFlag := app.Flag("docker-timeout", "Timeout for docker")
|
||||||
dockerTimeout := dockerTimeoutFlag.Default("1m").Duration()
|
dockerTimeout := dockerTimeoutFlag.Default("1m").Duration()
|
||||||
|
|
||||||
pewCommand := app.Command("pew", "Build, run and test module/exploit")
|
pewCommand := app.Command("pew", "Build, run and test module/exploit")
|
||||||
pewKernelFlag := pewCommand.Flag("kernel", "Override kernel regex")
|
pewKernelFlag := pewCommand.Flag("kernel", "Override kernel regex")
|
||||||
pewKernel := pewKernelFlag.String()
|
pewKernel := pewKernelFlag.String()
|
||||||
|
Loading…
Reference in New Issue
Block a user