diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-19 20:20:19 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-11-19 20:20:19 +0100 |
commit | 60427f066af7aefb806883809090120a9654331a (patch) | |
tree | 7fbfc1c3abd03aaa300ed54c92389ff4fa416b7e /commands/bridge_configure.go | |
parent | 62fea2615d2bb870721b745a5dbe017772f20918 (diff) | |
download | git-bug-60427f066af7aefb806883809090120a9654331a.tar.gz |
bridge configure: no default name if the default has already been created
Diffstat (limited to 'commands/bridge_configure.go')
-rw-r--r-- | commands/bridge_configure.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go index 12cc35e3..3562af17 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 } |