diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-05 01:42:36 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-07 01:17:59 +0200 |
commit | a6c8b6b78dcf9b31c73fe35545e3fb754e06851a (patch) | |
tree | b9b86262f478be9a0d4c65fbb4a17f7f0bb75e05 /commands/bridge_configure.go | |
parent | c52a467302608012c4fd7d496a7cd60ad153b5cd (diff) | |
download | git-bug-a6c8b6b78dcf9b31c73fe35545e3fb754e06851a.tar.gz |
make token visible in configuration process
validate token
global fixes
Diffstat (limited to 'commands/bridge_configure.go')
-rw-r--r-- | commands/bridge_configure.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go index 169919f6..cecfe139 100644 --- a/commands/bridge_configure.go +++ b/commands/bridge_configure.go @@ -6,13 +6,15 @@ import ( "os" "strconv" "strings" + "syscall" - "github.com/MichaelMure/git-bug/bridge/core" + "github.com/spf13/cobra" + "golang.org/x/crypto/ssh/terminal" "github.com/MichaelMure/git-bug/bridge" + "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/util/interrupt" - "github.com/spf13/cobra" ) const ( @@ -37,9 +39,11 @@ func runBridgeConfigure(cmd *cobra.Command, args []string) error { if err != nil { return err } + interrupt.RegisterCleaner(func() error { return terminal.Restore(int(syscall.Stdin), termState) }) + if bridgeConfigureTarget == "" { bridgeConfigureTarget, err = promptTarget() if err != nil { @@ -78,8 +82,9 @@ func promptTarget() (string, error) { fmt.Printf("target: ") line, err := bufio.NewReader(os.Stdin).ReadString('\n') + if err != nil { - return "", err + return "", fmt.Errorf("got err: '%v' '%v'", line, err) } line = strings.TrimRight(line, "\n") @@ -131,9 +136,9 @@ Detected projects: Select option: 1 -[0]: user provided token -[1]: interactive token creation -Select option: 0 +[1]: user provided token +[2]: interactive token creation +Select option: 1 You can generate a new token by visiting https://github.com/settings/tokens. Choose 'Generate new token' and set the necessary access scope for your repository. @@ -144,7 +149,7 @@ Public: Private: - 'repo' : to be able to read private repositories -Enter token: +Enter token: 87cf5c03b64029f18ea5f9ca5679daa08ccbd700 Successfully configured bridge: default # For Github |