From fe8a3b82a042fa99206b4bebc617414e939f093a Mon Sep 17 00:00:00 2001 From: SIGSEGV Date: Mon, 25 Jan 2021 17:31:43 +0800 Subject: [PATCH] Mark required flag in help message (#1089) Fix https://github.com/pingcap/tiup/issues/792 Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com> --- components/cluster/command/scale_in.go | 2 +- components/dm/command/import.go | 2 +- components/dm/command/scale_in.go | 2 +- server/package/package.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/cluster/command/scale_in.go b/components/cluster/command/scale_in.go index 91182278d3..6cd46020f0 100644 --- a/components/cluster/command/scale_in.go +++ b/components/cluster/command/scale_in.go @@ -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") diff --git a/components/dm/command/import.go b/components/dm/command/import.go index e357045efc..4bc64dae2c 100644 --- a/components/dm/command/import.go +++ b/components/dm/command/import.go @@ -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 diff --git a/components/dm/command/scale_in.go b/components/dm/command/scale_in.go index 0dde278b34..59b639df4c 100644 --- a/components/dm/command/scale_in.go +++ b/components/dm/command/scale_in.go @@ -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") diff --git a/server/package/package.go b/server/package/package.go index 03ef579f91..cf8aadf091 100644 --- a/server/package/package.go +++ b/server/package/package.go @@ -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")