PKGBUILD/cmd/remote/add.go

31 lines
546 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"
)
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],
}
if err := remote.Add(&remoteObject, configDir); err != nil {
log.Fatal(err)
}
},
}
func init() {
remoteCmd.AddCommand(addRemoteCmd)
}