Skip to content

Commit

Permalink
Make the rootCmd global
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Aug 4, 2019
1 parent a706c60 commit 8e601e3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cmd/dots/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ func loadConfigs(cmd *cobra.Command, args []string) error {
return nil
}

func main() {
cobra.EnableCommandSorting = false
var rootCmd = cobra.Command{
Use: "dots",
Short: "A portable tool for managing a single set of dotfiles",

rootCmd := cobra.Command{
Use: "dots",
Short: "A portable tool for managing a single set of dotfiles",
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: loadConfigs,
}

SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: loadConfigs,
}
func main() {
cobra.EnableCommandSorting = false

rootCmd.AddCommand(&filesCmd)
rootCmd.AddCommand(&diffCmd)
Expand Down

0 comments on commit 8e601e3

Please sign in to comment.