35 lines
670 B
Go
35 lines
670 B
Go
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"
|
|
)
|
|
|
|
var enabled bool
|
|
|
|
var addRemoteCmd = &cobra.Command{
|
|
Use: "add",
|
|
Short: "Add Remove Server",
|
|
Args: cobra.ExactArgs(2),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
remoteObject := types.Remote{
|
|
Name: args[0],
|
|
Address: args[1],
|
|
Enabled: enabled,
|
|
}
|
|
|
|
if err := remote.Add(&remoteObject, configDir); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
remoteCmd.AddCommand(addRemoteCmd)
|
|
addRemoteCmd.Flags().BoolVarP(&enabled, "enabled", "e", true, "Enable Remote Link")
|
|
}
|