34 lines
627 B
Go
34 lines
627 B
Go
package remote
|
|
|
|
import (
|
|
"log"
|
|
|
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/remote"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var all bool
|
|
|
|
var removeRemoteCmd = &cobra.Command{
|
|
Use: "remove",
|
|
Short: "remove",
|
|
Args: cobra.RangeArgs(0, 1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
if all {
|
|
if err := remote.RemoveAll(configDir); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
} else {
|
|
if err := remote.Remove(args[0], configDir); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
remoteCmd.AddCommand(removeRemoteCmd)
|
|
removeRemoteCmd.Flags().BoolVarP(&all, "all", "a", false, "Select all remote connections")
|
|
}
|