diff --git a/internal/cli/config/delete.go b/internal/cli/config/delete.go index 604d1258..275feada 100644 --- a/internal/cli/config/delete.go +++ b/internal/cli/config/delete.go @@ -39,12 +39,12 @@ func DeleteCmd(h *internal.Helper) *cobra.Command { var force bool var deleteCmd = &cobra.Command{ - Use: "delete ", + Use: "delete ", Short: "Delete a profile", Example: fmt.Sprintf(` Delete the profile configuration: - $ %[1]s config delete `, config.CliName), + $ %[1]s config delete `, config.CliName), Aliases: []string{"rm"}, - Args: util.RequiredArgs("profileName"), + Args: util.RequiredArgs("profile-name"), RunE: func(cmd *cobra.Command, args []string) error { // Configuration needs to be deleted from toml, as viper doesn't support this yet. // FIXME :: change when https://github.com/spf13/viper/pull/519 is merged. diff --git a/internal/cli/config/delete_test.go b/internal/cli/config/delete_test.go index c40464f0..ede22054 100644 --- a/internal/cli/config/delete_test.go +++ b/internal/cli/config/delete_test.go @@ -91,7 +91,7 @@ func (suite *DeleteConfigSuite) TestDeleteConfigArgs() { { name: "delete config with no args", args: []string{"--force"}, - err: fmt.Errorf("missing argument \n\nUsage:\n delete [flags]\n\nAliases:\n delete, rm\n\nExamples:\n Delete the profile configuration:\n $ ticloud config delete \n\nFlags:\n --force Delete a profile without confirmation\n -h, --help help for delete\n"), + err: fmt.Errorf("missing argument \n\nUsage:\n delete [flags]\n\nAliases:\n delete, rm\n\nExamples:\n Delete the profile configuration:\n $ ticloud config delete \n\nFlags:\n --force Delete a profile without confirmation\n -h, --help help for delete\n"), }, { name: "delete config with non-existed profile", diff --git a/internal/cli/config/describe.go b/internal/cli/config/describe.go index 4cf414ca..303025c8 100644 --- a/internal/cli/config/describe.go +++ b/internal/cli/config/describe.go @@ -29,12 +29,12 @@ import ( func DescribeCmd(h *internal.Helper) *cobra.Command { describeCmd := &cobra.Command{ - Use: "describe ", + Use: "describe ", Aliases: []string{"get"}, Short: "Describe a specific profile", Example: fmt.Sprintf(` Describe the profile configuration: - $ %[1]s config describe `, config.CliName), - Args: util.RequiredArgs("profileName"), + $ %[1]s config describe `, config.CliName), + Args: util.RequiredArgs("profile-name"), RunE: func(cmd *cobra.Command, args []string) error { name := args[0] err := config.ValidateProfile(name) diff --git a/internal/cli/config/describe_test.go b/internal/cli/config/describe_test.go index 1003cfe8..4df8a120 100644 --- a/internal/cli/config/describe_test.go +++ b/internal/cli/config/describe_test.go @@ -86,7 +86,7 @@ func (suite *DescribeConfigSuite) TestDescribeConfigArgs() { { name: "describe config with no args", args: []string{}, - err: fmt.Errorf("missing argument \n\nUsage:\n describe [flags]\n\nAliases:\n describe, get\n\nExamples:\n Describe the profile configuration:\n $ ticloud config describe \n\nFlags:\n -h, --help help for describe\n"), + err: fmt.Errorf("missing argument \n\nUsage:\n describe [flags]\n\nAliases:\n describe, get\n\nExamples:\n Describe the profile configuration:\n $ ticloud config describe \n\nFlags:\n -h, --help help for describe\n"), }, { name: "describe config with non-existed profile", diff --git a/internal/cli/config/set.go b/internal/cli/config/set.go index c1637022..26d045eb 100644 --- a/internal/cli/config/set.go +++ b/internal/cli/config/set.go @@ -30,7 +30,7 @@ import ( func SetCmd(h *internal.Helper) *cobra.Command { var setCmd = &cobra.Command{ - Use: "set ", + Use: "set ", Short: "Configure specific properties of the active profile", Long: fmt.Sprintf(`Configure specific properties of the active profile. Available properties : %v. @@ -42,7 +42,7 @@ If not, the config in the active profile will be set`, prop.ProfileProperties()) Set the value of the public-key in the specific profile "test": $ %[1]s config set public-key -P test`, config.CliName), - Args: util.RequiredArgs("propertyName", "value"), + Args: util.RequiredArgs("property-name", "value"), RunE: func(cmd *cobra.Command, args []string) error { propertyName := args[0] value := args[1] diff --git a/internal/cli/config/set_test.go b/internal/cli/config/set_test.go index bad2992b..1cad0417 100644 --- a/internal/cli/config/set_test.go +++ b/internal/cli/config/set_test.go @@ -91,7 +91,7 @@ func (suite *SetConfigSuite) TestSetConfigArgs() { { name: "set config with no args", args: []string{}, - err: fmt.Errorf("missing arguments \n\nUsage:\n set [flags]\n\nExamples:\n Set the value of the public-key in active profile:\n $ ticloud config set public-key \n\n Set the value of the public-key in the specific profile \"test\":\n $ ticloud config set public-key -P test\n\nFlags:\n -h, --help help for set\n"), + err: fmt.Errorf("missing arguments \n\nUsage:\n set [flags]\n\nExamples:\n Set the value of the public-key in active profile:\n $ ticloud config set public-key \n\n Set the value of the public-key in the specific profile \"test\":\n $ ticloud config set public-key -P test\n\nFlags:\n -h, --help help for set\n"), }, { name: "set config with unknown property", diff --git a/internal/cli/config/use.go b/internal/cli/config/use.go index 29133a71..3b1429c1 100644 --- a/internal/cli/config/use.go +++ b/internal/cli/config/use.go @@ -30,11 +30,11 @@ import ( func UseCmd(h *internal.Helper) *cobra.Command { var listCmd = &cobra.Command{ - Use: "use ", + Use: "use ", Short: "Use the specified profile as the active profile", Example: fmt.Sprintf(` Use the "test" profile as the active profile: $ %[1]s config use test`, config.CliName), - Args: util.RequiredArgs("profileName"), + Args: util.RequiredArgs("profile-name"), RunE: func(cmd *cobra.Command, args []string) error { profileName := args[0] err := SetProfile(h.IOStreams.Out, profileName) diff --git a/internal/cli/config/use_test.go b/internal/cli/config/use_test.go index e0a1191c..5bf19e17 100644 --- a/internal/cli/config/use_test.go +++ b/internal/cli/config/use_test.go @@ -92,7 +92,7 @@ func (suite *UseConfigSuite) TestUseConfigArgs() { { name: "use config with no args", args: []string{}, - err: fmt.Errorf("missing argument \n\nUsage:\n use [flags]\n\nExamples:\n Use the \"test\" profile as the active profile:\n $ ticloud config use test\n\nFlags:\n -h, --help help for use\n"), + err: fmt.Errorf("missing argument \n\nUsage:\n use [flags]\n\nExamples:\n Use the \"test\" profile as the active profile:\n $ ticloud config use test\n\nFlags:\n -h, --help help for use\n"), }, { name: "use config with non-existed profile", diff --git a/internal/cli/dataimport/start/local.go b/internal/cli/dataimport/start/local.go index bfa41620..acb95545 100644 --- a/internal/cli/dataimport/start/local.go +++ b/internal/cli/dataimport/start/local.go @@ -69,17 +69,17 @@ func LocalCmd(h *internal.Helper) *cobra.Command { } var localCmd = &cobra.Command{ - Use: "local ", + Use: "local ", Short: "Import a local file to TiDB Cloud", - Args: util.RequiredArgs("filePath"), + Args: util.RequiredArgs("file-path"), Example: fmt.Sprintf(` Start an import task in interactive mode: - $ %[1]s import start local + $ %[1]s import start local Start an import task in non-interactive mode: - $ %[1]s import start local --project-id --cluster-id --data-format --target-database --target-table + $ %[1]s import start local --project-id --cluster-id --data-format --target-database --target-table - Start an impor task with custom CSV format: - $ %[1]s import start local --project-id --cluster-id --data-format CSV --target-database --target-table --separator \" --delimiter \' --backslash-escape=false --trim-last-separator=true + Start an import task with custom CSV format: + $ %[1]s import start local --project-id --cluster-id --data-format CSV --target-database --target-table --separator \" --delimiter \' --backslash-escape=false --trim-last-separator=true `, config.CliName), PreRunE: func(cmd *cobra.Command, args []string) error { diff --git a/internal/cli/dataimport/start/local_test.go b/internal/cli/dataimport/start/local_test.go index 9955e29f..5ea65c59 100644 --- a/internal/cli/dataimport/start/local_test.go +++ b/internal/cli/dataimport/start/local_test.go @@ -153,7 +153,7 @@ func (suite *LocalImportSuite) TestLocalImportArgs() { { name: "start import without required file path", args: []string{"-p", projectID, "-c", clusterID, "--data-format", dataFormat, "--target-database", targetDatabase, "--target-table", targetTable}, - err: fmt.Errorf("missing argument \n\nUsage:\n start local [flags]\n\nExamples:\n Start an import task in interactive mode:\n $ ticloud import start local \n\n Start an import task in non-interactive mode:\n $ ticloud import start local --project-id --cluster-id --data-format --target-database --target-table \n\t\n Start an impor task with custom CSV format:\n $ ticloud import start local --project-id --cluster-id --data-format CSV --target-database --target-table --separator \\\" --delimiter \\' --backslash-escape=false --trim-last-separator=true\n\n\nFlags:\n -c, --cluster-id string Cluster ID\n --data-format string Data format, one of [CSV]\n -h, --help help for local\n -p, --project-id string Project ID\n --target-database string Target database to which import data\n --target-table string Target table to which import data\n\nGlobal Flags:\n --backslash-escape In CSV file whether to parse backslash inside fields as escape characters (default true)\n --delimiter string the delimiter used for quoting of CSV file (default \"\\\"\")\n --separator string the field separator of CSV file (default \",\")\n --trim-last-separator In CSV file whether to treat Separator as the line terminator and trim all trailing separators\n"), + err: fmt.Errorf("missing argument \n\nUsage:\n start local [flags]\n\nExamples:\n Start an import task in interactive mode:\n $ ticloud import start local \n\n Start an import task in non-interactive mode:\n $ ticloud import start local --project-id --cluster-id --data-format --target-database --target-table \n\t\n Start an import task with custom CSV format:\n $ ticloud import start local --project-id --cluster-id --data-format CSV --target-database --target-table --separator \\\" --delimiter \\' --backslash-escape=false --trim-last-separator=true\n\n\nFlags:\n -c, --cluster-id string Cluster ID\n --data-format string Data format, one of [CSV]\n -h, --help help for local\n -p, --project-id string Project ID\n --target-database string Target database to which import data\n --target-table string Target table to which import data\n\nGlobal Flags:\n --backslash-escape In CSV file whether to parse backslash inside fields as escape characters (default true)\n --delimiter string The delimiter used for quoting of CSV file (default \"\\\"\")\n --separator string The field separator of CSV file (default \",\")\n --trim-last-separator In CSV file whether to treat Separator as the line terminator and trim all trailing separators\n"), }, } diff --git a/internal/cli/dataimport/start/s3.go b/internal/cli/dataimport/start/s3.go index 239c1ccc..8d643757 100644 --- a/internal/cli/dataimport/start/s3.go +++ b/internal/cli/dataimport/start/s3.go @@ -77,7 +77,7 @@ func S3Cmd(h *internal.Helper) *cobra.Command { Start an import task in non-interactive mode: $ %[1]s import start s3 --project-id --cluster-id --aws-role-arn --data-format --source-url - Start an impor task with custom CSV format: + Start an import task with custom CSV format: $ %[1]s import start s3 --project-id --cluster-id --aws-role-arn --data-format CSV --source-url --separator \" --delimiter \' --backslash-escape=false --trim-last-separator=true `, config.CliName), diff --git a/internal/cli/dataimport/start/start.go b/internal/cli/dataimport/start/start.go index e05ac60f..7dde77a9 100644 --- a/internal/cli/dataimport/start/start.go +++ b/internal/cli/dataimport/start/start.go @@ -51,8 +51,8 @@ func StartCmd(h *internal.Helper) *cobra.Command { Short: "Start an import task", } - startCmd.PersistentFlags().String(flag.Delimiter, "\"", "the delimiter used for quoting of CSV file") - startCmd.PersistentFlags().String(flag.Separator, ",", "the field separator of CSV file") + startCmd.PersistentFlags().String(flag.Delimiter, "\"", "The delimiter used for quoting of CSV file") + startCmd.PersistentFlags().String(flag.Separator, ",", "The field separator of CSV file") startCmd.PersistentFlags().Bool(flag.TrimLastSeparator, false, "In CSV file whether to treat Separator as the line terminator and trim all trailing separators") startCmd.PersistentFlags().Bool(flag.BackslashEscape, true, "In CSV file whether to parse backslash inside fields as escape characters")