Skip to content

Commit 46ee755

Browse files
author
mritd
committed
feat(config): add new tag auto save
add new tag auto save Signed-off-by: mritd <[email protected]>
1 parent aa6e4b8 commit 46ee755

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/mmh/config.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func WriteExampleConfig() {
8989
Tags: []string{"prod"},
9090
Address: "10.10.4.12",
9191
Port: 22,
92-
PrivateKey: "/Users/mritd/.ssh/id_rsa",
92+
PrivateKey: filepath.Join(home, ".ssh", "id_rsa"),
9393
PrivateKeyPassword: "password",
9494
},
9595
})
@@ -182,6 +182,7 @@ func AddServer() {
182182
return nil
183183
}, "Tags:")
184184

185+
// if it is a new tag, write the configuration file
185186
inputTags := strings.Fields(p.Run())
186187
for _, tag := range inputTags {
187188
newTag := tag
@@ -190,6 +191,7 @@ func AddServer() {
190191
allTags = append(allTags, newTag)
191192
}
192193
}
194+
viper.Set(keyTags, allTags)
193195

194196
// ssh user
195197
p = promptx.NewDefaultPrompt(func(line []rune) error {

0 commit comments

Comments
 (0)