Skip to content

Commit

Permalink
move app name to the const
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Jul 20, 2020
1 parent 27ea99d commit 43b4128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package cmd
const (
pbOwner = "protocolbuffers"
pbRepo = "protobuf"
pbName = "pbvm"
)
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ var Verbose bool

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "pbvm",
Use: pbName,
Short: "Protocol Buffers Version Manager",
Long: `pbvm is a CLI tool for easy install/switch any versions of the Protocol Buffers.`,
Long: `It is a CLI tool for easy install/switch any versions of the Protocol Buffers.`,
Version: "0.0.1",
}

Expand All @@ -60,7 +60,7 @@ func init() {
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.pbvm.yaml)")
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/."+pbName+".yaml)")
rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
}

Expand All @@ -79,7 +79,7 @@ func initConfig() {

// Search config in home directory with name ".pbvm" (without extension).
viper.AddConfigPath(home)
viper.SetConfigName(".pbvm")
viper.SetConfigName("." + pbName)
}

viper.AutomaticEnv() // read in environment variables that match
Expand Down

0 comments on commit 43b4128

Please sign in to comment.