gitlab.com/pidrakin/dotfiles-cli@v1.7.5/main.go (about) 1 package main 2 3 import ( 4 log "github.com/sirupsen/logrus" 5 "gitlab.com/pidrakin/dotfiles-cli/cli" 6 "gitlab.com/pidrakin/dotfiles-cli/cli/completion" 7 "gitlab.com/pidrakin/dotfiles-cli/cli/config" 8 "gitlab.com/pidrakin/dotfiles-cli/cli/diff" 9 "gitlab.com/pidrakin/dotfiles-cli/cli/eject" 10 "gitlab.com/pidrakin/dotfiles-cli/cli/initialize" 11 "gitlab.com/pidrakin/dotfiles-cli/cli/install" 12 "gitlab.com/pidrakin/dotfiles-cli/cli/link" 13 "gitlab.com/pidrakin/dotfiles-cli/cli/rollout" 14 "gitlab.com/pidrakin/dotfiles-cli/cli/status" 15 "gitlab.com/pidrakin/dotfiles-cli/cli/unlink" 16 "gitlab.com/pidrakin/dotfiles-cli/text" 17 "os" 18 ) 19 20 func main() { 21 rootHandler := cli.NewRootHandler("dotfiles", "", "") 22 23 completionHandler := completion.NewHandler( 24 text.CompletionUse, 25 text.CompletionShort, 26 "", 27 ) 28 rootHandler.AddCommand(completionHandler.Command()) 29 30 initHandler, err := initialize.NewHandler( 31 text.InitUse, 32 text.InitShort, 33 text.InitLong, 34 ) 35 if err != nil { 36 log.Fatal(err) 37 } 38 rootHandler.AddCommand(initHandler.Command()) 39 40 installHandler, err := install.NewHandler( 41 text.InstallUse, 42 text.InstallShort, 43 text.InstallLong, 44 ) 45 if err != nil { 46 log.Fatal(err) 47 } 48 rootHandler.AddCommand(installHandler.Command()) 49 50 linkHandler, err := link.NewHandler( 51 text.LinkUse, 52 text.LinkShort, 53 text.LinkLong, 54 ) 55 if err != nil { 56 log.Fatal(err) 57 } 58 rootHandler.AddCommand(linkHandler.Command()) 59 60 unlinkHandler := unlink.NewHandler( 61 text.UnlinkUse, 62 text.UnlinkShort, 63 text.UnlinkLong, 64 ) 65 rootHandler.AddCommand(unlinkHandler.Command()) 66 67 diffHandler, err := diff.NewHandler( 68 text.DiffUse, 69 text.DiffShort, 70 text.DiffLong, 71 ) 72 if err != nil { 73 log.Fatal(err) 74 } 75 rootHandler.AddCommand(diffHandler.Command()) 76 77 rolloutHandler, err := rollout.NewHandler( 78 text.RolloutUse, 79 text.RolloutShort, 80 text.RolloutLong, 81 ) 82 if err != nil { 83 log.Fatal(err) 84 } 85 rootHandler.AddCommand(rolloutHandler.Command()) 86 87 statusHandler, err := status.NewHandler( 88 text.StatusUse, 89 text.StatusShort, 90 text.StatusLong, 91 ) 92 if err != nil { 93 log.Fatal(err) 94 } 95 rootHandler.AddCommand(statusHandler.Command()) 96 97 configHandler, err := config.NewHandler( 98 "config", 99 "view or set configs", 100 "view or set configs for the state or repo config", 101 ) 102 if err != nil { 103 log.Fatal(err) 104 } 105 rootHandler.AddCommand(configHandler.Command()) 106 107 ejectHandler, err := eject.NewHandler( 108 "eject", 109 "eject internal config files", 110 "allows ejecting internal config files in the current working directory", 111 ) 112 if err != nil { 113 log.Fatal(err) 114 } 115 rootHandler.AddCommand(ejectHandler.Command()) 116 117 if err := rootHandler.Execute(); err != nil { 118 //cobra prints errors self 119 os.Exit(1) 120 } 121 return 122 }