From 60427f066af7aefb806883809090120a9654331a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Tue, 19 Nov 2019 20:20:19 +0100 Subject: [PATCH] bridge configure: no default name if the default has already been created --- commands/bridge_configure.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go index 12cc35e351eb38e11efe8e3b30fb1ce63bdab827..3562af17c8a471df5f3e87f851706d8203af2903 100644 --- a/commands/bridge_configure.go +++ b/commands/bridge_configure.go @@ -94,8 +94,14 @@ func promptTarget() (string, error) { } func promptName(repo repository.RepoCommon) (string, error) { + defaultExist := core.BridgeExist(repo, defaultName) + for { - fmt.Printf("name [%s]: ", defaultName) + if defaultExist { + fmt.Printf("name: ") + } else { + fmt.Printf("name [%s]: ", defaultName) + } line, err := bufio.NewReader(os.Stdin).ReadString('\n') if err != nil { @@ -105,6 +111,10 @@ func promptName(repo repository.RepoCommon) (string, error) { line = strings.TrimRight(line, "\n") name := line + if defaultExist && name == "" { + continue + } + if name == "" { name = defaultName }