Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark required flag in help message #1089

Merged
merged 3 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/cluster/command/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func newScaleInCmd() *cobra.Command {
},
}

cmd.Flags().StringSliceVarP(&gOpt.Nodes, "node", "N", nil, "Specify the nodes")
cmd.Flags().StringSliceVarP(&gOpt.Nodes, "node", "N", nil, "Specify the nodes (required)")
cmd.Flags().Uint64Var(&gOpt.APITimeout, "transfer-timeout", 300, "Timeout in seconds when transferring PD and TiKV store leaders")
cmd.Flags().BoolVar(&gOpt.Force, "force", false, "Force just try stop and destroy instance before removing the instance from topo")

Expand Down
2 changes: 1 addition & 1 deletion components/dm/command/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func newImportCmd() *cobra.Command {
cmd.Flags().StringVarP(&ansibleDir, "dir", "d", "./", "The path to DM-Ansible directory")
cmd.Flags().StringVar(&inventoryFileName, "inventory", cansible.AnsibleInventoryFile, "The name of inventory file")
cmd.Flags().StringVarP(&rename, "rename", "r", "", "Rename the imported cluster to `NAME`")
cmd.Flags().StringVarP(&clusterVersion, "cluster-version", "v", "", "cluster version of DM to deploy")
cmd.Flags().StringVarP(&clusterVersion, "cluster-version", "v", "", "cluster version of DM to deploy (required)")

err := cmd.MarkFlagRequired("cluster-version")
if err != nil { // if no this flag
Expand Down
2 changes: 1 addition & 1 deletion components/dm/command/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func newScaleInCmd() *cobra.Command {
},
}

cmd.Flags().StringSliceVarP(&gOpt.Nodes, "node", "N", nil, "Specify the nodes")
cmd.Flags().StringSliceVarP(&gOpt.Nodes, "node", "N", nil, "Specify the nodes (required)")
cmd.Flags().BoolVar(&gOpt.Force, "force", false, "Force just try stop and destroy instance before removing the instance from topo")

_ = cmd.MarkFlagRequired("node")
Expand Down
4 changes: 2 additions & 2 deletions server/package/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func execute() error {
rootCmd.Flags().StringVar(&options.goos, "os", runtime.GOOS, "Target OS of the package")
rootCmd.Flags().StringVar(&options.goarch, "arch", runtime.GOARCH, "Target ARCH of the package")
rootCmd.Flags().StringVarP(&options.dir, "", "C", "", "Change directory before compress")
rootCmd.Flags().StringVar(&options.name, "name", "", "Name of the package")
rootCmd.Flags().StringVar(&options.version, "release", "", "Version of the package")
rootCmd.Flags().StringVar(&options.name, "name", "", "Name of the package (required)")
rootCmd.Flags().StringVar(&options.version, "release", "", "Version of the package (required)")
rootCmd.Flags().StringVar(&options.entry, "entry", "", "(deprecated) Entry point of the package")
rootCmd.Flags().StringVar(&options.desc, "desc", "", "(deprecated) Description of the package")
rootCmd.Flags().BoolVar(&options.standalone, "standalone", false, "(deprecated) Can the component run standalone")
Expand Down