Skip to content

Commit

Permalink
Mark required flag in help message (#1089)
Browse files Browse the repository at this point in the history
Fix #792

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
  • Loading branch information
lucklove and ti-chi-bot authored Jan 25, 2021
1 parent 7b86020 commit fe8a3b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
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

0 comments on commit fe8a3b8

Please sign in to comment.