mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-24 05:27:56 +02:00
Added constants for app name and version, use custom user-agent
This commit is contained in:
parent
f6b4ea4a46
commit
46e6a667c8
10 changed files with 75 additions and 6 deletions
|
@ -23,17 +23,18 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"go.uploadedlobster.com/scotty/internal/version"
|
||||
)
|
||||
|
||||
var cfgFile string
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "scotty",
|
||||
Use: version.AppName,
|
||||
Short: "Beam data between music listening services",
|
||||
Long: `Scotty transfers your listens/scrobbles between ListenBrainz and
|
||||
various other listening and streaming services.`,
|
||||
Version: "0.1.0",
|
||||
Version: version.AppVersion,
|
||||
// Uncomment the following line if your bare application
|
||||
// has an action associated with it:
|
||||
// Run: func(cmd *cobra.Command, args []string) { },
|
||||
|
@ -67,7 +68,7 @@ func init() {
|
|||
func defaultConfigDir() string {
|
||||
configDir, err := os.UserConfigDir()
|
||||
cobra.CheckErr(err)
|
||||
return path.Join(configDir, "scotty")
|
||||
return path.Join(configDir, version.AppName)
|
||||
}
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
|
@ -78,7 +79,7 @@ func initConfig() {
|
|||
} else {
|
||||
viper.AddConfigPath(defaultConfigDir())
|
||||
viper.SetConfigType("toml")
|
||||
viper.SetConfigName("scotty")
|
||||
viper.SetConfigName(version.AppName)
|
||||
}
|
||||
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue