| Tim Windelschmidt | 6d33a43 | 2025-02-04 14:34:25 +0100 | [diff] [blame] | 1 | // Copyright The Monogon Project Authors. |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| Tim Windelschmidt | 886c386 | 2023-05-23 16:47:41 +0200 | [diff] [blame] | 4 | package main |
| 5 | |
| 6 | import ( |
| 7 | "flag" |
| 8 | |
| 9 | "github.com/spf13/cobra" |
| 10 | |
| Tim Windelschmidt | 4264b8c | 2023-06-12 23:54:58 +0200 | [diff] [blame] | 11 | "k8s.io/klog/v2" |
| Tim Windelschmidt | 886c386 | 2023-05-23 16:47:41 +0200 | [diff] [blame] | 12 | |
| Tim Windelschmidt | b6308cd | 2023-10-10 21:19:03 +0200 | [diff] [blame] | 13 | "source.monogon.dev/cloud/equinix/wrapngo" |
| Tim Windelschmidt | 886c386 | 2023-05-23 16:47:41 +0200 | [diff] [blame] | 14 | ) |
| 15 | |
| 16 | // rootCmd represents the base command when called without any subcommands |
| 17 | var rootCmd = &cobra.Command{ |
| 18 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error { |
| 19 | if c.APIKey == "" || c.User == "" { |
| 20 | klog.Exitf("-equinix_api_username and -equinix_api_key must be set") |
| 21 | } |
| 22 | return nil |
| 23 | }, |
| 24 | } |
| 25 | |
| 26 | var c wrapngo.Opts |
| 27 | |
| 28 | func init() { |
| 29 | c.RegisterFlags() |
| 30 | rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine) |
| 31 | } |
| 32 | |
| 33 | func main() { |
| 34 | cobra.CheckErr(rootCmd.Execute()) |
| 35 | } |