diff --git a/cmd/user.go b/cmd/user.go index 4af23bc..7109644 100644 --- a/cmd/user.go +++ b/cmd/user.go @@ -7,6 +7,7 @@ import ( "github.com/doneill/er-cli/api" "github.com/olekukonko/tablewriter" "github.com/spf13/cobra" + "github.com/spf13/viper" ) var all bool @@ -72,6 +73,17 @@ func user() { table.Render() } + + viper.ReadInConfig() + if !viper.IsSet("remote_id") { + viper.Set("remote_id", userResponse.Data.ID) + err := viper.WriteConfigAs(viper.ConfigFileUsed()) + if err != nil { + fmt.Println("Error writing configuration file:", err) + } else { + fmt.Println("Config updated user id!") + } + } } }