mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
fixing up templates more
This commit is contained in:
parent
26d210e2cd
commit
17dc9f8142
3 changed files with 47 additions and 45 deletions
|
@ -56,8 +56,8 @@ Init will not use an existing directory with contents.`,
|
|||
PkgName: pkgName,
|
||||
Legal: getLicense(),
|
||||
Copyright: copyrightLine(),
|
||||
// viper
|
||||
// appname
|
||||
Viper: viper.GetBool("useViper"),
|
||||
AppName: path.Base(pkgName),
|
||||
}
|
||||
|
||||
// create main.go
|
||||
|
|
|
@ -14,6 +14,8 @@ type Project struct {
|
|||
Copyright string
|
||||
AbsolutePath string
|
||||
Legal License
|
||||
Viper bool
|
||||
AppName string
|
||||
|
||||
// v1
|
||||
absPath string
|
||||
|
|
|
@ -94,9 +94,9 @@ func initConfig() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Search config in home directory with name ".{{ .appName }}" (without extension).
|
||||
// Search config in home directory with name ".{{ .AppName }}" (without extension).
|
||||
viper.AddConfigPath(home)
|
||||
viper.SetConfigName(".{{ .appName }}")
|
||||
viper.SetConfigName(".{{ .AppName }}")
|
||||
}
|
||||
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
|
Loading…
Reference in a new issue