2017-11-12 18:58:19 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2021-07-16 18:28:13 +00:00
|
|
|
"io"
|
2018-05-01 18:14:05 +00:00
|
|
|
"math/rand"
|
2021-07-16 18:28:13 +00:00
|
|
|
"os"
|
2018-05-01 18:14:05 +00:00
|
|
|
"time"
|
2017-11-12 18:58:19 +00:00
|
|
|
|
2021-06-26 04:46:51 +00:00
|
|
|
eefleetctl "github.com/fleetdm/fleet/v4/ee/fleetctl"
|
2017-11-12 18:58:19 +00:00
|
|
|
"github.com/kolide/kit/version"
|
2021-03-13 00:42:38 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
2017-11-12 18:58:19 +00:00
|
|
|
)
|
|
|
|
|
|
2020-11-18 01:12:37 +00:00
|
|
|
const (
|
|
|
|
|
defaultFileMode = 0600
|
|
|
|
|
)
|
|
|
|
|
|
2018-05-01 18:14:05 +00:00
|
|
|
func init() {
|
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
2017-11-12 18:58:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func main() {
|
2021-07-16 18:28:13 +00:00
|
|
|
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"
|
2020-12-10 19:26:00 +00:00
|
|
|
app.Usage = "CLI for operating Fleet"
|
2018-05-01 18:14:05 +00:00
|
|
|
app.Version = version.Version().Version
|
2021-07-16 18:28:13 +00:00
|
|
|
app.ExitErrHandler = exitErrHandler
|
2018-05-01 18:14:05 +00:00
|
|
|
cli.VersionPrinter = func(c *cli.Context) {
|
|
|
|
|
version.PrintFull()
|
2017-11-12 18:58:19 +00:00
|
|
|
}
|
2021-07-16 18:28:13 +00:00
|
|
|
app.Reader = reader
|
|
|
|
|
app.Writer = writer
|
|
|
|
|
app.ErrWriter = writer
|
2017-11-12 18:58:19 +00:00
|
|
|
|
2021-03-13 00:42:38 +00:00
|
|
|
app.Commands = []*cli.Command{
|
2018-05-07 23:50:20 +00:00
|
|
|
applyCommand(),
|
2018-05-08 02:07:00 +00:00
|
|
|
deleteCommand(),
|
2018-05-04 16:53:21 +00:00
|
|
|
setupCommand(),
|
|
|
|
|
loginCommand(),
|
|
|
|
|
logoutCommand(),
|
2018-05-17 22:54:34 +00:00
|
|
|
queryCommand(),
|
2020-06-23 15:11:47 +00:00
|
|
|
getCommand(),
|
2021-09-14 13:58:35 +00:00
|
|
|
{
|
2018-05-01 22:58:53 +00:00
|
|
|
Name: "config",
|
2020-11-18 01:12:37 +00:00
|
|
|
Usage: "Modify Fleet server connection settings",
|
2021-03-13 00:42:38 +00:00
|
|
|
Subcommands: []*cli.Command{
|
2018-05-04 16:53:21 +00:00
|
|
|
configSetCommand(),
|
|
|
|
|
configGetCommand(),
|
2018-05-01 22:58:53 +00:00
|
|
|
},
|
2018-05-01 18:14:05 +00:00
|
|
|
},
|
2018-05-21 16:26:22 +00:00
|
|
|
convertCommand(),
|
2020-01-24 05:27:20 +00:00
|
|
|
goqueryCommand(),
|
2020-11-05 01:06:55 +00:00
|
|
|
userCommand(),
|
2020-11-18 01:12:37 +00:00
|
|
|
debugCommand(),
|
2020-11-18 21:16:18 +00:00
|
|
|
previewCommand(),
|
2021-03-26 17:46:51 +00:00
|
|
|
eefleetctl.UpdatesCommand(),
|
2021-07-21 17:03:10 +00:00
|
|
|
hostsCommand(),
|
2021-09-14 13:58:35 +00:00
|
|
|
vulnerabilityDataStreamCommand(),
|
2021-09-09 05:34:12 +00:00
|
|
|
packageCommand(),
|
2017-11-12 18:58:19 +00:00
|
|
|
}
|
2021-07-16 18:28:13 +00:00
|
|
|
return app
|
2017-11-12 18:58:19 +00:00
|
|
|
}
|