Skip to content

Commit

Permalink
add user id to config
Browse files Browse the repository at this point in the history
  • Loading branch information
doneill committed Dec 31, 2023
1 parent 4f0484f commit 5a18a93
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!")
}
}
}
}

Expand Down

0 comments on commit 5a18a93

Please sign in to comment.