github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/cmd/orbctl/main.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 7 "github.com/caos/orbos/mntr" 8 ) 9 10 var ( 11 // Build arguments 12 gitCommit = "none" 13 version = "none" 14 githubClientID = "none" 15 githubClientSecret = "none" 16 monitor = mntr.Monitor{ 17 OnInfo: mntr.LogMessage, 18 OnChange: mntr.LogMessage, 19 OnError: mntr.LogError, 20 OnRecoverPanic: mntr.LogPanic, 21 } 22 ) 23 24 func main() { 25 26 defer func() { monitor.RecoverPanic(recover()) }() 27 28 rootCmd, getRootValues := RootCommand() 29 rootCmd.Version = fmt.Sprintf("%s %s\n", version, gitCommit) 30 31 start := StartCommand() 32 start.AddCommand( 33 StartBoom(getRootValues), 34 StartOrbiter(getRootValues), 35 StartNetworking(getRootValues), 36 ) 37 38 file := FileCommand() 39 file.AddCommand( 40 EditCommand(getRootValues), 41 PrintCommand(getRootValues), 42 // PatchCommand(getRootValues), 43 ) 44 45 nodes := NodeCommand() 46 nodes.AddCommand( 47 ReplaceCommand(getRootValues), 48 RebootCommand(getRootValues), 49 ExecCommand(getRootValues), 50 ListCommand(getRootValues), 51 ) 52 53 rootCmd.AddCommand( 54 ReadSecretCommand(getRootValues), 55 WriteSecretCommand(getRootValues), 56 TeardownCommand(getRootValues), 57 ConfigCommand(getRootValues), 58 APICommand(getRootValues), 59 TakeoffCommand(getRootValues), 60 file, 61 start, 62 nodes, 63 ) 64 65 if err := rootCmd.Execute(); err != nil { 66 monitor.Error(mntr.ToUserError(err)) 67 os.Exit(1) 68 } 69 }