diff options
Diffstat (limited to 'commands/bridge_token_add.go')
-rw-r--r-- | commands/bridge_token_add.go | 15 |
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{ |