fleet/cmd/fleetctl/fleetctl.go

69 lines
1.3 KiB
Go
Raw Normal View History

package main
import (
"io"
2018-05-01 18:14:05 +00:00
"math/rand"
"os"
2018-05-01 18:14:05 +00:00
"time"
2021-06-26 04:46:51 +00:00
eefleetctl "github.com/fleetdm/fleet/v4/ee/fleetctl"
"github.com/kolide/kit/version"
"github.com/urfave/cli/v2"
)
const (
defaultFileMode = 0600
)
2018-05-01 18:14:05 +00:00
func init() {
rand.Seed(time.Now().UnixNano())
}
func main() {
app := createApp(os.Stdin, os.Stdout, nil)
app.RunAndExitOnError()
}
func createApp(reader io.Reader, writer io.Writer, exitErrHandler cli.ExitErrHandlerFunc) *cli.App {
2018-05-01 18:14:05 +00:00
app := cli.NewApp()
app.Name = "fleetctl"
app.Usage = "CLI for operating Fleet"
2018-05-01 18:14:05 +00:00
app.Version = version.Version().Version
app.ExitErrHandler = exitErrHandler
2018-05-01 18:14:05 +00:00
cli.VersionPrinter = func(c *cli.Context) {
version.PrintFull()
}
app.Reader = reader
app.Writer = writer
app.ErrWriter = writer
app.Commands = []*cli.Command{
applyCommand(),
2018-05-08 02:07:00 +00:00
deleteCommand(),
setupCommand(),
loginCommand(),
logoutCommand(),
queryCommand(),
getCommand(),
{
2018-05-01 22:58:53 +00:00
Name: "config",
Usage: "Modify Fleet server connection settings",
Subcommands: []*cli.Command{
configSetCommand(),
configGetCommand(),
2018-05-01 22:58:53 +00:00
},
2018-05-01 18:14:05 +00:00
},
convertCommand(),
goqueryCommand(),
userCommand(),
debugCommand(),
previewCommand(),
eefleetctl.UpdatesCommand(),
hostsCommand(),
vulnerabilityDataStreamCommand(),
packageCommand(),
}
return app
}