Skip to content

Commit

Permalink
fix documents (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanyu66 authored Jan 19, 2023
1 parent 1906565 commit df42ec1
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions internal/cli/config/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func DeleteCmd(h *internal.Helper) *cobra.Command {
var force bool

var deleteCmd = &cobra.Command{
Use: "delete <profileName>",
Use: "delete <profile-name>",
Short: "Delete a profile",
Example: fmt.Sprintf(` Delete the profile configuration:
$ %[1]s config delete <profileName>`, config.CliName),
$ %[1]s config delete <profile-name>`, 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.
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/config/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (suite *DeleteConfigSuite) TestDeleteConfigArgs() {
{
name: "delete config with no args",
args: []string{"--force"},
err: fmt.Errorf("missing argument <profileName> \n\nUsage:\n delete <profileName> [flags]\n\nAliases:\n delete, rm\n\nExamples:\n Delete the profile configuration:\n $ ticloud config delete <profileName>\n\nFlags:\n --force Delete a profile without confirmation\n -h, --help help for delete\n"),
err: fmt.Errorf("missing argument <profile-name> \n\nUsage:\n delete <profile-name> [flags]\n\nAliases:\n delete, rm\n\nExamples:\n Delete the profile configuration:\n $ ticloud config delete <profile-name>\n\nFlags:\n --force Delete a profile without confirmation\n -h, --help help for delete\n"),
},
{
name: "delete config with non-existed profile",
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/config/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import (

func DescribeCmd(h *internal.Helper) *cobra.Command {
describeCmd := &cobra.Command{
Use: "describe <profileName>",
Use: "describe <profile-name>",
Aliases: []string{"get"},
Short: "Describe a specific profile",
Example: fmt.Sprintf(` Describe the profile configuration:
$ %[1]s config describe <profileName>`, config.CliName),
Args: util.RequiredArgs("profileName"),
$ %[1]s config describe <profile-name>`, config.CliName),
Args: util.RequiredArgs("profile-name"),
RunE: func(cmd *cobra.Command, args []string) error {
name := args[0]
err := config.ValidateProfile(name)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/config/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (suite *DescribeConfigSuite) TestDescribeConfigArgs() {
{
name: "describe config with no args",
args: []string{},
err: fmt.Errorf("missing argument <profileName> \n\nUsage:\n describe <profileName> [flags]\n\nAliases:\n describe, get\n\nExamples:\n Describe the profile configuration:\n $ ticloud config describe <profileName>\n\nFlags:\n -h, --help help for describe\n"),
err: fmt.Errorf("missing argument <profile-name> \n\nUsage:\n describe <profile-name> [flags]\n\nAliases:\n describe, get\n\nExamples:\n Describe the profile configuration:\n $ ticloud config describe <profile-name>\n\nFlags:\n -h, --help help for describe\n"),
},
{
name: "describe config with non-existed profile",
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/config/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

func SetCmd(h *internal.Helper) *cobra.Command {
var setCmd = &cobra.Command{
Use: "set <propertyName> <value>",
Use: "set <property-name> <value>",
Short: "Configure specific properties of the active profile",
Long: fmt.Sprintf(`Configure specific properties of the active profile.
Available properties : %v.
Expand All @@ -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 <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]
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/config/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (suite *SetConfigSuite) TestSetConfigArgs() {
{
name: "set config with no args",
args: []string{},
err: fmt.Errorf("missing arguments <propertyName, value> \n\nUsage:\n set <propertyName> <value> [flags]\n\nExamples:\n Set the value of the public-key in active profile:\n $ ticloud config set public-key <public-key>\n\n Set the value of the public-key in the specific profile \"test\":\n $ ticloud config set public-key <public-key> -P test\n\nFlags:\n -h, --help help for set\n"),
err: fmt.Errorf("missing arguments <property-name, value> \n\nUsage:\n set <property-name> <value> [flags]\n\nExamples:\n Set the value of the public-key in active profile:\n $ ticloud config set public-key <public-key>\n\n Set the value of the public-key in the specific profile \"test\":\n $ ticloud config set public-key <public-key> -P test\n\nFlags:\n -h, --help help for set\n"),
},
{
name: "set config with unknown property",
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/config/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import (

func UseCmd(h *internal.Helper) *cobra.Command {
var listCmd = &cobra.Command{
Use: "use <profileName>",
Use: "use <profile-name>",
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)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/config/use_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (suite *UseConfigSuite) TestUseConfigArgs() {
{
name: "use config with no args",
args: []string{},
err: fmt.Errorf("missing argument <profileName> \n\nUsage:\n use <profileName> [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 <profile-name> \n\nUsage:\n use <profile-name> [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",
Expand Down
12 changes: 6 additions & 6 deletions internal/cli/dataimport/start/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ func LocalCmd(h *internal.Helper) *cobra.Command {
}

var localCmd = &cobra.Command{
Use: "local <filePath>",
Use: "local <file-path>",
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 <filePath>
$ %[1]s import start local <file-path>
Start an import task in non-interactive mode:
$ %[1]s import start local <filePath> --project-id <project-id> --cluster-id <cluster-id> --data-format <data-format> --target-database <target-database> --target-table <target-table>
$ %[1]s import start local <file-path> --project-id <project-id> --cluster-id <cluster-id> --data-format <data-format> --target-database <target-database> --target-table <target-table>
Start an impor task with custom CSV format:
$ %[1]s import start local <filePath> --project-id <project-id> --cluster-id <cluster-id> --data-format CSV --target-database <target-database> --target-table <target-table> --separator \" --delimiter \' --backslash-escape=false --trim-last-separator=true
Start an import task with custom CSV format:
$ %[1]s import start local <file-path> --project-id <project-id> --cluster-id <cluster-id> --data-format CSV --target-database <target-database> --target-table <target-table> --separator \" --delimiter \' --backslash-escape=false --trim-last-separator=true
`,
config.CliName),
PreRunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/dataimport/start/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <filePath> \n\nUsage:\n start local <filePath> [flags]\n\nExamples:\n Start an import task in interactive mode:\n $ ticloud import start local <filePath>\n\n Start an import task in non-interactive mode:\n $ ticloud import start local <filePath> --project-id <project-id> --cluster-id <cluster-id> --data-format <data-format> --target-database <target-database> --target-table <target-table>\n\t\n Start an impor task with custom CSV format:\n $ ticloud import start local <filePath> --project-id <project-id> --cluster-id <cluster-id> --data-format CSV --target-database <target-database> --target-table <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 <file-path> \n\nUsage:\n start local <file-path> [flags]\n\nExamples:\n Start an import task in interactive mode:\n $ ticloud import start local <file-path>\n\n Start an import task in non-interactive mode:\n $ ticloud import start local <file-path> --project-id <project-id> --cluster-id <cluster-id> --data-format <data-format> --target-database <target-database> --target-table <target-table>\n\t\n Start an import task with custom CSV format:\n $ ticloud import start local <file-path> --project-id <project-id> --cluster-id <cluster-id> --data-format CSV --target-database <target-database> --target-table <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"),
},
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/dataimport/start/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <project-id> --cluster-id <cluster-id> --aws-role-arn <aws-role-arn> --data-format <data-format> --source-url <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 <project-id> --cluster-id <cluster-id> --aws-role-arn <aws-role-arn> --data-format CSV --source-url <source-url> --separator \" --delimiter \' --backslash-escape=false --trim-last-separator=true
`,
config.CliName),
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/dataimport/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit df42ec1

Please sign in to comment.