Lorenz Brun | 6adf884 | 2021-10-05 13:39:11 +0200 | [diff] [blame] | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "github.com/spf13/cobra" |
| 5 | ) |
| 6 | |
| 7 | // rootCmd represents the base command when called without any subcommands |
| 8 | var rootCmd = &cobra.Command{ |
| 9 | Use: "metroctl", |
| 10 | Short: "metroctl controls Metropolis nodes and clusters.", |
| 11 | } |
| 12 | |
Mateusz Zalega | d5f2f7a | 2022-07-05 18:48:56 +0200 | [diff] [blame] | 13 | type metroctlFlags struct { |
| 14 | // clusterEndpoints is a list of the targeted cluster's endpoints, used by |
| 15 | // commands that perform RPC on it. |
| 16 | clusterEndpoints []string |
Mateusz Zalega | f777496 | 2022-07-08 12:26:55 +0200 | [diff] [blame] | 17 | // proxyAddr is a SOCKS5 proxy address the cluster will be accessed through. |
| 18 | proxyAddr string |
Mateusz Zalega | d5f2f7a | 2022-07-05 18:48:56 +0200 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | var flags metroctlFlags |
| 22 | |
| 23 | func init() { |
| 24 | rootCmd.PersistentFlags().StringArrayVar(&flags.clusterEndpoints, "endpoints", nil, "A list of the target cluster's endpoints.") |
Mateusz Zalega | f777496 | 2022-07-08 12:26:55 +0200 | [diff] [blame] | 25 | rootCmd.PersistentFlags().StringVar(&flags.proxyAddr, "proxy", "", "SOCKS5 proxy address") |
Mateusz Zalega | d5f2f7a | 2022-07-05 18:48:56 +0200 | [diff] [blame] | 26 | } |
| 27 | |
Lorenz Brun | 6adf884 | 2021-10-05 13:39:11 +0200 | [diff] [blame] | 28 | func main() { |
| 29 | cobra.CheckErr(rootCmd.Execute()) |
| 30 | } |