31 lines
532 B
Go
31 lines
532 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 addRemoteCmd = &cobra.Command{
|
||
|
Use: "add",
|
||
|
Short: "add",
|
||
|
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)
|
||
|
}
|