diff options
author | Amine <hilalyamine@gmail.com> | 2019-06-05 00:45:34 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-05 01:40:37 +0200 |
commit | c52a467302608012c4fd7d496a7cd60ad153b5cd (patch) | |
tree | bc407b9a1eeedbb6a1dcbce6b39406c7b2420865 | |
parent | 7923d6c942114b710089c2b2e7f49bc7ac374b44 (diff) | |
download | git-bug-c52a467302608012c4fd7d496a7cd60ad153b5cd.tar.gz |
Allow cancelling configuration
correct error message
Co-Authored-By: Michael Muré <batolettre@gmail.com>
-rw-r--r-- | bridge/github/config.go | 4 | ||||
-rw-r--r-- | commands/bridge_configure.go | 7 | ||||
-rw-r--r-- | commands/bridge_rm.go | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/bridge/github/config.go b/bridge/github/config.go index 4a3bddfb..b5468846 100644 --- a/bridge/github/config.go +++ b/bridge/github/config.go @@ -98,7 +98,7 @@ func (*Github) Configure(repo repository.RepoCommon, params core.BridgeParams) ( return nil, err } if !ok { - return nil, fmt.Errorf("project doesn't exist or authentication token has a wrong scope") + return nil, fmt.Errorf("project doesn't exist or authentication token has an incorrect scope") } conf[keyToken] = token @@ -428,7 +428,7 @@ func splitURL(url string) (owner string, project string, err error) { owner = res[1] project = res[2] - return owner, project, nil + return } func getValidGithubRemoteURLs(remotes map[string]string) []string { diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go index c9ac1680..169919f6 100644 --- a/commands/bridge_configure.go +++ b/commands/bridge_configure.go @@ -33,6 +33,13 @@ func runBridgeConfigure(cmd *cobra.Command, args []string) error { defer backend.Close() interrupt.RegisterCleaner(backend.Close) + termState, err := terminal.GetState(int(syscall.Stdin)) + if err != nil { + return err + } + interrupt.RegisterCleaner(func() error { + return terminal.Restore(int(syscall.Stdin), termState) + }) if bridgeConfigureTarget == "" { bridgeConfigureTarget, err = promptTarget() if err != nil { diff --git a/commands/bridge_rm.go b/commands/bridge_rm.go index 1b67608b..80a831ff 100644 --- a/commands/bridge_rm.go +++ b/commands/bridge_rm.go @@ -24,7 +24,7 @@ func runBridgeRm(cmd *cobra.Command, args []string) error { } var bridgeRmCmd = &cobra.Command{ - Use: "rm <name>", + Use: "rm name <name>", Short: "Delete a configured bridge.", PreRunE: loadRepo, RunE: runBridgeRm, |