From eb5384a61ebb6594c7169f9237ae2e03e40fa87e Mon Sep 17 00:00:00 2001 From: Lonng Date: Mon, 27 Jul 2020 11:54:35 +0800 Subject: [PATCH 1/3] Support posix style argument for --user" Signed-off-by: Lonng --- components/cluster/command/deploy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cluster/command/deploy.go b/components/cluster/command/deploy.go index 9d3c82c1aa..d51adc1e85 100644 --- a/components/cluster/command/deploy.go +++ b/components/cluster/command/deploy.go @@ -103,7 +103,7 @@ func newDeploy() *cobra.Command { }, } - cmd.Flags().StringVar(&opt.user, "user", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") + cmd.Flags().StringVarP(&opt.user, "user","u", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") cmd.Flags().StringVarP(&opt.identityFile, "identity_file", "i", opt.identityFile, "The path of the SSH identity file. If specified, public key authentication will be used.") cmd.Flags().BoolVarP(&opt.usePassword, "password", "p", false, "Use password of target hosts. If specified, password authentication will be used.") cmd.Flags().BoolVarP(&opt.ignoreConfigCheck, "ignore-config-check", "", opt.ignoreConfigCheck, "Ignore the config check result") From c8c2c968c9c04ad393dc92d42798e82fd02fb1cc Mon Sep 17 00:00:00 2001 From: Lonng Date: Mon, 27 Jul 2020 12:57:31 +0800 Subject: [PATCH 2/3] format Signed-off-by: Lonng --- components/cluster/command/deploy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cluster/command/deploy.go b/components/cluster/command/deploy.go index d51adc1e85..e9de5eb1e7 100644 --- a/components/cluster/command/deploy.go +++ b/components/cluster/command/deploy.go @@ -103,7 +103,7 @@ func newDeploy() *cobra.Command { }, } - cmd.Flags().StringVarP(&opt.user, "user","u", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") + cmd.Flags().StringVarP(&opt.user, "user", "u", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") cmd.Flags().StringVarP(&opt.identityFile, "identity_file", "i", opt.identityFile, "The path of the SSH identity file. If specified, public key authentication will be used.") cmd.Flags().BoolVarP(&opt.usePassword, "password", "p", false, "Use password of target hosts. If specified, password authentication will be used.") cmd.Flags().BoolVarP(&opt.ignoreConfigCheck, "ignore-config-check", "", opt.ignoreConfigCheck, "Ignore the config check result") From 67f584dbbd6547556aad51f0c76bb796e84bb2dd Mon Sep 17 00:00:00 2001 From: Lonng Date: Mon, 27 Jul 2020 13:56:38 +0800 Subject: [PATCH 3/3] fix Signed-off-by: Lonng --- components/cluster/command/check.go | 2 +- components/cluster/command/scale_out.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cluster/command/check.go b/components/cluster/command/check.go index c21adca0d6..725cb96c27 100644 --- a/components/cluster/command/check.go +++ b/components/cluster/command/check.go @@ -107,7 +107,7 @@ conflict checks with other clusters`, }, } - cmd.Flags().StringVar(&opt.user, "user", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") + cmd.Flags().StringVarP(&opt.user, "user", "u", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") cmd.Flags().StringVarP(&opt.identityFile, "identity_file", "i", opt.identityFile, "The path of the SSH identity file. If specified, public key authentication will be used.") cmd.Flags().BoolVarP(&opt.usePassword, "password", "p", false, "Use password of target hosts. If specified, password authentication will be used.") diff --git a/components/cluster/command/scale_out.go b/components/cluster/command/scale_out.go index ae72d34b61..becbc85b34 100644 --- a/components/cluster/command/scale_out.go +++ b/components/cluster/command/scale_out.go @@ -63,7 +63,7 @@ func newScaleOutCmd() *cobra.Command { }, } - cmd.Flags().StringVar(&opt.user, "user", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") + cmd.Flags().StringVarP(&opt.user, "user", "u", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") cmd.Flags().StringVarP(&opt.identityFile, "identity_file", "i", opt.identityFile, "The path of the SSH identity file. If specified, public key authentication will be used.") cmd.Flags().BoolVarP(&opt.usePassword, "password", "p", false, "Use password of target hosts. If specified, password authentication will be used.")