kubekey/cmd/ctl/options/persistent_options.go
24sama f8462eb110 dev-v2.0.0: refactor cmd package
Signed-off-by: 24sama <leo@kubesphere.io>
2021-11-14 20:32:51 +08:00

24 lines
701 B
Go

package options
import (
"github.com/spf13/cobra"
)
type CommonOptions struct {
InCluster bool
Verbose bool
SkipConfirmCheck bool
IgnoreErr bool
}
func NewCommonOptions() *CommonOptions {
return &CommonOptions{}
}
func (o *CommonOptions) AddCommonFlag(cmd *cobra.Command) {
cmd.Flags().BoolVar(&o.InCluster, "in-cluster", false, "Running inside the cluster")
cmd.Flags().BoolVar(&o.Verbose, "debug", true, "Print detailed information")
cmd.Flags().BoolVarP(&o.SkipConfirmCheck, "yes", "y", false, "Skip confirm check")
cmd.Flags().BoolVar(&o.IgnoreErr, "ignore-err", false, "Ignore the error message, remove the host which reported error and force to continue")
}