git-bug/commands/bridge_token_rm.go

37 lines
629 B
Go
Raw Normal View History

package commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/MichaelMure/git-bug/bridge/core"
)
func runBridgeTokenRm(cmd *cobra.Command, args []string) error {
token, err := core.LoadTokenPrefix(repo, args[0])
if err != nil {
return err
}
err = core.RemoveToken(repo, token.ID())
if err != nil {
return err
}
fmt.Printf("token %s removed\n", token.ID())
return nil
}
var bridgeTokenRmCmd = &cobra.Command{
2019-11-10 17:50:56 +03:00
Use: "rm <id>",
Short: "Remove a token.",
PreRunE: loadRepo,
RunE: runBridgeTokenRm,
Args: cobra.ExactArgs(1),
}
func init() {
bridgeTokenCmd.AddCommand(bridgeTokenRmCmd)
}