aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-10-12 18:10:44 +0900
committeramine <hilalyamine@gmail.com>2019-11-09 13:26:48 +0100
commit3984919a3df95b8ec203bcb82b66c9c2270579c7 (patch)
tree1a32f0978e76f097edf2635191e6940b990efe05 /commands
parent3433fa5def3fb3c2707bae1aeb4ae1bd62c930de (diff)
downloadgit-bug-3984919a3df95b8ec203bcb82b66c9c2270579c7.tar.gz
bridge: various cleanups
Diffstat (limited to 'commands')
-rw-r--r--commands/bridge_token_add.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/commands/bridge_token_add.go b/commands/bridge_token_add.go
index 1e62a383..76fed237 100644
--- a/commands/bridge_token_add.go
+++ b/commands/bridge_token_add.go
@@ -1,6 +1,7 @@
package commands
import (
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/MichaelMure/git-bug/bridge/core"
@@ -11,17 +12,15 @@ var (
)
func runBridgeTokenAdd(cmd *cobra.Command, args []string) error {
+ if err := bridgeToken.Validate(); err != nil {
+ return errors.Wrap(err, "invalid token")
+ }
+
if bridgeToken.Global {
- return core.StoreToken(
- repo,
- &bridgeToken,
- )
+ return core.StoreToken(repo, &bridgeToken)
}
- return core.StoreGlobalToken(
- repo,
- &bridgeToken,
- )
+ return core.StoreGlobalToken(repo, &bridgeToken)
}
var bridgeTokenAddCmd = &cobra.Command{