mirror of
https://gitlab.durp.info/durfy/apps/durpcli.git
synced 2026-05-07 07:50:35 -05:00
update
This commit is contained in:
parent
d96fae1276
commit
125e0dc9cf
9 changed files with 167 additions and 83 deletions
|
|
@ -1,7 +1,8 @@
|
|||
package cfg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
|
@ -12,10 +13,14 @@ var newcfgcmd = &cobra.Command{
|
|||
Short: "Generates a config file using current config",
|
||||
Long: ``,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := viper.WriteConfigAs(".DurpCLI.yaml")
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigName(".durpcli")
|
||||
viper.AddConfigPath(usr.HomeDir)
|
||||
viper.WriteConfig()
|
||||
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue