// create etcd client // register cobra subcommand func InitCmd(parent *cobra.Command, servers *string) { etcdServers = servers // register new subcommand initCmd := &cobra.Command{ Use: "init <machine1,machine2,..>", Short: "init the machine registry", Long: "init the machine registry with specific ip network information", Run: registryInit, } initCmd.Flags().StringVarP(&globalSubnet, "ipnet", "n", registry.DEFAULT_SUBNET, "cidr ip subnet information") parent.AddCommand(initCmd) }