cloud: split shepherd up
Change-Id: I8e386d9eaaf17543743e1e8a37a8d71426910d59
Reviewed-on: https://review.monogon.dev/c/monogon/+/2213
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/equinix/cli/main.go b/cloud/equinix/cli/main.go
new file mode 100644
index 0000000..a85c0d0
--- /dev/null
+++ b/cloud/equinix/cli/main.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "flag"
+
+ "github.com/spf13/cobra"
+
+ "k8s.io/klog/v2"
+
+ "source.monogon.dev/cloud/equinix/wrapngo"
+)
+
+// rootCmd represents the base command when called without any subcommands
+var rootCmd = &cobra.Command{
+ PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
+ if c.APIKey == "" || c.User == "" {
+ klog.Exitf("-equinix_api_username and -equinix_api_key must be set")
+ }
+ return nil
+ },
+}
+
+var c wrapngo.Opts
+
+func init() {
+ c.RegisterFlags()
+ rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
+}
+
+func main() {
+ cobra.CheckErr(rootCmd.Execute())
+}