Skip to content

Commit 3117827

Browse files
authored
Fix the setup command when saving the config file (#185)
1 parent 597e7b2 commit 3117827

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/install.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ func newInstallCmd(ctx context.Context) (cmd *cobra.Command) {
2323
},
2424
}
2525
cmd = &cobra.Command{
26-
Use: "install",
27-
Short: "Install a package from https://github.com/LinuxSuRen/hd-home",
26+
Use: "install",
27+
Short: "Install a package from https://github.com/LinuxSuRen/hd-home",
28+
Long: `Install a package from https://github.com/LinuxSuRen/hd-home
29+
Cannot find your desired package? Please run command: hd fetch --reset, then try it again`,
2830
Example: "hd install goget",
2931
Args: cobra.MinimumNArgs(1),
3032
PreRunE: opt.preRunE,

cmd/setup.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/AlecAivazis/survey/v2"
55
"github.com/spf13/cobra"
66
"github.com/spf13/viper"
7+
"os"
78
)
89

910
func newSetupCommand() (cmd *cobra.Command) {
@@ -32,6 +33,6 @@ func (o *setupOption) runE(cmd *cobra.Command, args []string) (err error) {
3233
return
3334
}
3435

35-
err = viper.WriteConfig()
36+
err = viper.SafeWriteConfigAs(os.ExpandEnv("$HOME/.config/hd.yaml"))
3637
return
3738
}

0 commit comments

Comments
 (0)