mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
484c6153e3
* wip * Add delete user command and translator * Add host transfer command * Add changes file * Undo bad refactor * Fix copypaste error * Implement with interfaces instead of assertions * Ad documentation and simplify implementation further * Update docs/1-Using-Fleet/3-REST-API.md Co-authored-by: Zach Wasserman <zach@fleetdm.com> Co-authored-by: Zach Wasserman <zach@fleetdm.com>
67 lines
1.2 KiB
Go
67 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"math/rand"
|
|
"os"
|
|
"time"
|
|
|
|
eefleetctl "github.com/fleetdm/fleet/v4/ee/fleetctl"
|
|
"github.com/kolide/kit/version"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
const (
|
|
defaultFileMode = 0600
|
|
)
|
|
|
|
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 {
|
|
app := cli.NewApp()
|
|
app.Name = "fleetctl"
|
|
app.Usage = "CLI for operating Fleet"
|
|
app.Version = version.Version().Version
|
|
app.ExitErrHandler = exitErrHandler
|
|
cli.VersionPrinter = func(c *cli.Context) {
|
|
version.PrintFull()
|
|
}
|
|
app.Reader = reader
|
|
app.Writer = writer
|
|
app.ErrWriter = writer
|
|
|
|
app.Commands = []*cli.Command{
|
|
applyCommand(),
|
|
deleteCommand(),
|
|
setupCommand(),
|
|
loginCommand(),
|
|
logoutCommand(),
|
|
queryCommand(),
|
|
getCommand(),
|
|
&cli.Command{
|
|
Name: "config",
|
|
Usage: "Modify Fleet server connection settings",
|
|
Subcommands: []*cli.Command{
|
|
configSetCommand(),
|
|
configGetCommand(),
|
|
},
|
|
},
|
|
convertCommand(),
|
|
goqueryCommand(),
|
|
userCommand(),
|
|
debugCommand(),
|
|
previewCommand(),
|
|
eefleetctl.UpdatesCommand(),
|
|
hostsCommand(),
|
|
}
|
|
return app
|
|
}
|