aboutsummaryrefslogtreecommitdiff
path: root/cmd/root.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-08-16 22:53:05 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-08-16 22:53:05 +0530
commit10657c98d38f0db4f58c853f125301ee8af8542f (patch)
tree6197c9a00b824b88a8823eb8004aa6817757bb9c /cmd/root.go
parent20c4f14750f18050f88aceef8adb788342576a25 (diff)
pushing sample macli config file (which doesnt work)
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/root.go b/cmd/root.go
index 2c6ca56..7e23984 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -40,6 +40,7 @@ var rootCmd = &cobra.Command{
func init() {
viper.SetConfigName("macli")
viper.SetConfigType("yaml")
+ viper.AddConfigPath(".")
viper.AddConfigPath("$HOME/.config/macli")
viper.AddConfigPath("/etc/macli")
@@ -53,9 +54,10 @@ func init() {
}
}
- name := viper.Get("name").(map[string]interface{})
+ authConfig := viper.Get("auth").(map[string]interface{})
+ defConfig := viper.Get("defaults").(map[string]interface{})
- fmt.Println("Config File Contents:", name["last"])
+ fmt.Println("Config File Contents:", authConfig["token"], defConfig["prompt_length"])
os.Exit(0)
}