Skip to content

Commit

Permalink
The config command outputs the path to the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
thibauult committed Jan 13, 2024
1 parent 235a655 commit bd42d98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Execute(buildInfo *openhue.BuildInfo) {
root.AddCommand(version.NewCmdVersion(ctx))
root.AddCommand(setup.NewCmdSetup(ctx.Io))
root.AddCommand(setup.NewCmdDiscover(ctx.Io))
root.AddCommand(setup.NewCmdConfigure())
root.AddCommand(setup.NewCmdConfigure(ctx.Io))

root.AddCommand(set.NewCmdSet(ctx))
root.AddCommand(get.NewCmdGet(ctx))
Expand Down
6 changes: 4 additions & 2 deletions cmd/setup/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package setup

import (
"fmt"
"github.com/spf13/cobra"
"openhue-cli/openhue"
)
Expand All @@ -19,7 +20,7 @@ type Options struct {
}

// NewCmdConfigure creates the configure command
func NewCmdConfigure() *cobra.Command {
func NewCmdConfigure(io openhue.IOStreams) *cobra.Command {

o := Options{}

Expand All @@ -35,8 +36,9 @@ func NewCmdConfigure() *cobra.Command {
Key: o.key,
}

_, err := c.Save()
path, err := c.Save()
cobra.CheckErr(err)
fmt.Fprintln(io.Out, "[OK] Configuration saved in file", path)
},
}

Expand Down

0 comments on commit bd42d98

Please sign in to comment.