PKGBUILD/cmd/remote/add.go

35 lines
670 B
Go
Raw Normal View History

2018-11-19 21:36:21 +00:00
package remote
import (
"log"
"git.cryptic.systems/fh-trier/go-flucky/pkg/remote"
"git.cryptic.systems/fh-trier/go-flucky/pkg/types"
"github.com/spf13/cobra"
)
2018-11-28 11:41:50 +00:00
var enabled bool
2018-11-19 21:36:21 +00:00
var addRemoteCmd = &cobra.Command{
Use: "add",
2018-11-21 19:48:10 +00:00
Short: "Add Remove Server",
2018-11-19 21:36:21 +00:00
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
remoteObject := types.Remote{
Name: args[0],
Address: args[1],
2018-11-28 11:41:50 +00:00
Enabled: enabled,
2018-11-19 21:36:21 +00:00
}
if err := remote.Add(&remoteObject, configDir); err != nil {
log.Fatal(err)
}
},
}
func init() {
remoteCmd.AddCommand(addRemoteCmd)
2018-11-28 11:41:50 +00:00
addRemoteCmd.Flags().BoolVarP(&enabled, "enabled", "e", true, "Enable Remote Link")
2018-11-19 21:36:21 +00:00
}