Last active
December 22, 2018 06:07
-
-
Save syossan27/110607cc3940a8acc517972de59f768a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (cs *Connections) Update(name string) { | |
// 同名の接続情報が存在するか確認 | |
// 存在していた場合のみ更新 | |
conns := *cs | |
for key, conn := range conns { | |
if conn.Name == name { | |
conns[key].Host, conns[key].User, conns[key].Password = foundation.UpdatePrompt(conn.Host, conn.User, conn.Password) | |
break | |
} | |
} | |
save(&conns) | |
} | |
func UpdatePrompt(host, user, password string) (string, string, string) { | |
h := prompter.Prompt("Host", host) | |
u := prompter.Prompt("User", user) | |
p := prompter.Password("Password") | |
if p == "" { | |
p = password | |
} | |
return h, u, p | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment