Start laying out the structure of gooni
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/cli/version"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
// Run the app. This is the main app entry point
|
||||
func Run() error {
|
||||
util.Log("Running")
|
||||
root.Cmd.Version(version.Version)
|
||||
_, err := root.Cmd.Parse(os.Args[1:])
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package info
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("info", "Display information about OONI Probe")
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
util.Log("Info")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package list
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("list", "List measurements")
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
util.Log("Listing")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package nettest
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("nettest", "Run a specific nettest")
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
util.Log("Nettest")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package root
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
// Cmd is the root command
|
||||
var Cmd = kingpin.New("ooni", "")
|
||||
|
||||
// Command is syntax sugar for defining sub-commands
|
||||
var Command = Cmd.Command
|
||||
|
||||
func init() {
|
||||
Cmd.PreAction(func(ctx *kingpin.ParseContext) error {
|
||||
util.Log("Running pre-action")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package run
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("run", "Run a test group or OONI Run link")
|
||||
|
||||
nettestGroup := cmd.Arg("name", "the nettest group to run").Required().String()
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
util.Log("Starting %s", nettestGroup)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package nettest
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("show", "Show a specific measurement")
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
util.Log("Show")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package upload
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
"github.com/openobservatory/gooni/internal/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("upload", "Upload a specific measurement")
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
util.Log("Uploading")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/openobservatory/gooni/internal/cli/root"
|
||||
)
|
||||
|
||||
const Version = "0.0.1"
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("version", "Show version.")
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
fmt.Println(Version)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user