2018-11-19 21:36:21 +00:00
|
|
|
package remote
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/remote"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var all bool
|
|
|
|
|
2018-11-21 19:48:10 +00:00
|
|
|
var rmRemoteCmd = &cobra.Command{
|
2018-12-07 21:50:28 +00:00
|
|
|
Use: "rm",
|
|
|
|
Short: "Remove Remote Server",
|
|
|
|
Aliases: []string{"remove"},
|
|
|
|
Args: cobra.RangeArgs(0, 1),
|
2018-11-19 21:36:21 +00:00
|
|
|
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() {
|
2018-11-21 19:48:10 +00:00
|
|
|
remoteCmd.AddCommand(rmRemoteCmd)
|
|
|
|
rmRemoteCmd.Flags().BoolVarP(&all, "all", "a", false, "Select all remote connections")
|
2018-11-19 21:36:21 +00:00
|
|
|
}
|