1package commands
2
3import (
4 "fmt"
5
6 "github.com/spf13/cobra"
7
8 "github.com/MichaelMure/git-bug/bridge"
9 "github.com/MichaelMure/git-bug/cache"
10 "github.com/MichaelMure/git-bug/util/interrupt"
11)
12
13func runBridge(cmd *cobra.Command, args []string) error {
14 backend, err := cache.NewRepoCache(repo)
15 if err != nil {
16 return err
17 }
18 defer backend.Close()
19 interrupt.RegisterCleaner(backend.Close)
20
21 configured, err := bridge.ConfiguredBridges(backend)
22 if err != nil {
23 return err
24 }
25
26 for _, c := range configured {
27 fmt.Println(c)
28 }
29
30 return nil
31}
32
33var bridgeCmd = &cobra.Command{
34 Use: "bridge",
35 Short: "Configure and use bridges to other bug trackers.",
36 PreRunE: loadRepo,
37 RunE: runBridge,
38 Args: cobra.NoArgs,
39}
40
41func init() {
42 RootCmd.AddCommand(bridgeCmd)
43}