1package commands
 2
 3import (
 4	"fmt"
 5
 6	"github.com/spf13/cobra"
 7
 8	"github.com/MichaelMure/git-bug/bridge/core/auth"
 9)
10
11func runBridgeAuthRm(cmd *cobra.Command, args []string) error {
12	cred, err := auth.LoadWithPrefix(repo, args[0])
13	if err != nil {
14		return err
15	}
16
17	err = auth.Remove(repo, cred.ID())
18	if err != nil {
19		return err
20	}
21
22	fmt.Printf("credential %s removed\n", cred.ID())
23	return nil
24}
25
26var bridgeAuthRmCmd = &cobra.Command{
27	Use:     "rm <id>",
28	Short:   "Remove a credential.",
29	PreRunE: loadRepo,
30	RunE:    runBridgeAuthRm,
31	Args:    cobra.ExactArgs(1),
32}
33
34func init() {
35	bridgeAuthCmd.AddCommand(bridgeAuthRmCmd)
36}