Add usage string when command fails with incorrect arguments (#1276)

## Changes
Add usage string when command fails with incorrect arguments

Fixes #1119

## Tests
Example output

```
> databricks libraries cluster-status 
Error: accepts 1 arg(s), received 0

Usage:
  databricks libraries cluster-status CLUSTER_ID [flags]

Flags:
  -h, --help   help for cluster-status

Global Flags:
      --debug            enable debug logging
  -o, --output type      output type: text or json (default text)
  -p, --profile string   ~/.databrickscfg profile
  -t, --target string    bundle target to use (if applicable)
```
This commit is contained in:
Andrew Nester 2024-03-12 15:12:34 +01:00 committed by GitHub
parent 945d522dab
commit c7818560ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
124 changed files with 525 additions and 461 deletions

View File

@ -194,7 +194,7 @@ func new{{.PascalName}}() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
{{- if $hasDifferentArgsWithJsonFlag }} {{- if $hasDifferentArgsWithJsonFlag }}
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs({{len .Request.RequiredPathFields}})(cmd, args) err := root.ExactArgs({{len .Request.RequiredPathFields}})(cmd, args)
if err != nil { if err != nil {
{{- if eq 0 (len .Request.RequiredPathFields) }} {{- if eq 0 (len .Request.RequiredPathFields) }}
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide{{- range $index, $field := .Request.RequiredFields}}{{if $index}},{{end}} '{{$field.Name}}'{{end}} in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide{{- range $index, $field := .Request.RequiredFields}}{{if $index}},{{end}} '{{$field.Name}}'{{end}} in your JSON input")
@ -206,7 +206,7 @@ func new{{.PascalName}}() *cobra.Command {
} }
{{- end }} {{- end }}
{{- if $hasRequiredArgs }} {{- if $hasRequiredArgs }}
check := cobra.ExactArgs({{len .RequiredPositionalArguments}}) check := root.ExactArgs({{len .RequiredPositionalArguments}})
return check(cmd, args) return check(cmd, args)
{{- else}} {{- else}}
return nil return nil

View File

@ -322,7 +322,7 @@
"description": "A unique name for the job cluster. This field is required and must be unique within the job.\n`JobTaskSettings` may refer to this field to determine which cluster to launch for the task execution." "description": "A unique name for the job cluster. This field is required and must be unique within the job.\n`JobTaskSettings` may refer to this field to determine which cluster to launch for the task execution."
}, },
"new_cluster": { "new_cluster": {
"description": "If new_cluster, a description of a cluster that is created for only for this task.", "description": "If new_cluster, a description of a cluster that is created for each task.",
"properties": { "properties": {
"apply_policy_default_values": { "apply_policy_default_values": {
"description": "" "description": ""
@ -785,7 +785,7 @@
"description": "Optional schema to write to. This parameter is only used when a warehouse_id is also provided. If not provided, the `default` schema is used." "description": "Optional schema to write to. This parameter is only used when a warehouse_id is also provided. If not provided, the `default` schema is used."
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
}, },
"warehouse_id": { "warehouse_id": {
"description": "ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the profile and connection details to dbt. It can be overridden on a per-command basis by using the `--profiles-dir` command line argument." "description": "ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the profile and connection details to dbt. It can be overridden on a per-command basis by using the `--profiles-dir` command line argument."
@ -930,7 +930,7 @@
"description": "An optional minimal interval in milliseconds between the start of the failed run and the subsequent retry run. The default behavior is that unsuccessful runs are immediately retried." "description": "An optional minimal interval in milliseconds between the start of the failed run and the subsequent retry run. The default behavior is that unsuccessful runs are immediately retried."
}, },
"new_cluster": { "new_cluster": {
"description": "If new_cluster, a description of a cluster that is created for only for this task.", "description": "If new_cluster, a description of a cluster that is created for each task.",
"properties": { "properties": {
"apply_policy_default_values": { "apply_policy_default_values": {
"description": "" "description": ""
@ -1269,7 +1269,7 @@
"description": "The path of the notebook to be run in the Databricks workspace or remote repository.\nFor notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash.\nFor notebooks stored in a remote repository, the path must be relative. This field is required.\n" "description": "The path of the notebook to be run in the Databricks workspace or remote repository.\nFor notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash.\nFor notebooks stored in a remote repository, the path must be relative. This field is required.\n"
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
} }
} }
}, },
@ -1371,7 +1371,7 @@
"description": "The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For python files stored in the Databricks workspace, the path must be absolute and begin with `/`. For files stored in a remote repository, the path must be relative. This field is required." "description": "The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For python files stored in the Databricks workspace, the path must be absolute and begin with `/`. For files stored in a remote repository, the path must be relative. This field is required."
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
} }
} }
}, },
@ -1449,7 +1449,7 @@
"description": "Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths." "description": "Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths."
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
} }
} }
}, },
@ -2855,7 +2855,7 @@
"description": "A unique name for the job cluster. This field is required and must be unique within the job.\n`JobTaskSettings` may refer to this field to determine which cluster to launch for the task execution." "description": "A unique name for the job cluster. This field is required and must be unique within the job.\n`JobTaskSettings` may refer to this field to determine which cluster to launch for the task execution."
}, },
"new_cluster": { "new_cluster": {
"description": "If new_cluster, a description of a cluster that is created for only for this task.", "description": "If new_cluster, a description of a cluster that is created for each task.",
"properties": { "properties": {
"apply_policy_default_values": { "apply_policy_default_values": {
"description": "" "description": ""
@ -3318,7 +3318,7 @@
"description": "Optional schema to write to. This parameter is only used when a warehouse_id is also provided. If not provided, the `default` schema is used." "description": "Optional schema to write to. This parameter is only used when a warehouse_id is also provided. If not provided, the `default` schema is used."
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
}, },
"warehouse_id": { "warehouse_id": {
"description": "ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the profile and connection details to dbt. It can be overridden on a per-command basis by using the `--profiles-dir` command line argument." "description": "ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the profile and connection details to dbt. It can be overridden on a per-command basis by using the `--profiles-dir` command line argument."
@ -3463,7 +3463,7 @@
"description": "An optional minimal interval in milliseconds between the start of the failed run and the subsequent retry run. The default behavior is that unsuccessful runs are immediately retried." "description": "An optional minimal interval in milliseconds between the start of the failed run and the subsequent retry run. The default behavior is that unsuccessful runs are immediately retried."
}, },
"new_cluster": { "new_cluster": {
"description": "If new_cluster, a description of a cluster that is created for only for this task.", "description": "If new_cluster, a description of a cluster that is created for each task.",
"properties": { "properties": {
"apply_policy_default_values": { "apply_policy_default_values": {
"description": "" "description": ""
@ -3802,7 +3802,7 @@
"description": "The path of the notebook to be run in the Databricks workspace or remote repository.\nFor notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash.\nFor notebooks stored in a remote repository, the path must be relative. This field is required.\n" "description": "The path of the notebook to be run in the Databricks workspace or remote repository.\nFor notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash.\nFor notebooks stored in a remote repository, the path must be relative. This field is required.\n"
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
} }
} }
}, },
@ -3904,7 +3904,7 @@
"description": "The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For python files stored in the Databricks workspace, the path must be absolute and begin with `/`. For files stored in a remote repository, the path must be relative. This field is required." "description": "The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For python files stored in the Databricks workspace, the path must be absolute and begin with `/`. For files stored in a remote repository, the path must be relative. This field is required."
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
} }
} }
}, },
@ -3982,7 +3982,7 @@
"description": "Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths." "description": "Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths."
}, },
"source": { "source": {
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n" "description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
} }
} }
}, },

View File

@ -72,7 +72,7 @@ func newGetAssignableRolesForResource() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -140,7 +140,7 @@ func newGetRuleSet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -78,7 +78,7 @@ func newDownload() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -317,7 +317,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -68,7 +68,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -139,7 +139,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -197,7 +197,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -301,7 +301,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -163,7 +163,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -235,7 +235,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -66,7 +66,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -295,7 +295,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -116,13 +116,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'label', 'list_type' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'label', 'list_type' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -395,13 +395,13 @@ func newReplace() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(4) check := root.ExactArgs(4)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -152,7 +152,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -288,7 +288,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -353,13 +353,13 @@ func newPatchStatus() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only LOG_DELIVERY_CONFIGURATION_ID as positional arguments. Provide 'status' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only LOG_DELIVERY_CONFIGURATION_ID as positional arguments. Provide 'status' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -75,7 +75,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -145,7 +145,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -210,7 +210,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -272,7 +272,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -333,7 +333,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -70,7 +70,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -135,7 +135,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -193,7 +193,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -294,7 +294,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -80,13 +80,13 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'region' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'region' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -171,13 +171,13 @@ func newCreatePrivateEndpointRule() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only NETWORK_CONNECTIVITY_CONFIG_ID as positional arguments. Provide 'resource_id', 'group_id' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only NETWORK_CONNECTIVITY_CONFIG_ID as positional arguments. Provide 'resource_id', 'group_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -250,7 +250,7 @@ func newDeleteNetworkConnectivityConfiguration() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -313,7 +313,7 @@ func newDeletePrivateEndpointRule() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -372,7 +372,7 @@ func newGetNetworkConnectivityConfiguration() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -431,7 +431,7 @@ func newGetPrivateEndpointRule() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -489,7 +489,7 @@ func newListNetworkConnectivityConfigurations() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -544,7 +544,7 @@ func newListPrivateEndpointRules() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -81,13 +81,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'network_name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'network_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -66,7 +66,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -74,7 +74,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -129,7 +129,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -93,13 +93,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'private_access_settings_name', 'region' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'private_access_settings_name', 'region' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -395,13 +395,13 @@ func newReplace() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only PRIVATE_ACCESS_SETTINGS_ID as positional arguments. Provide 'private_access_settings_name', 'region' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only PRIVATE_ACCESS_SETTINGS_ID as positional arguments. Provide 'private_access_settings_name', 'region' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -75,7 +75,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -139,7 +139,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -197,7 +197,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -300,7 +300,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -79,7 +79,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -141,7 +141,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -205,7 +205,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -85,7 +85,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -294,7 +294,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -23,6 +23,9 @@ func New() *cobra.Command {
Annotations: map[string]string{ Annotations: map[string]string{
"package": "settings", "package": "settings",
}, },
// This service is being previewed; hide from help output.
Hidden: true,
} }
// Add subservices // Add subservices

View File

@ -78,7 +78,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -146,7 +146,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -208,7 +208,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -268,7 +268,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -333,7 +333,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -93,7 +93,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -310,7 +310,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -88,13 +88,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'vpc_endpoint_name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'vpc_endpoint_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -72,7 +72,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -137,7 +137,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -199,7 +199,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -261,7 +261,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -117,13 +117,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'workspace_name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'workspace_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -5,6 +5,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/client"
@ -35,7 +36,7 @@ func makeCommand(method string) *cobra.Command {
command := &cobra.Command{ command := &cobra.Command{
Use: strings.ToLower(method), Use: strings.ToLower(method),
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
Short: fmt.Sprintf("Perform %s request", method), Short: fmt.Sprintf("Perform %s request", method),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
var path = args[0] var path = args[0]

View File

@ -6,6 +6,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils" "github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -13,7 +14,7 @@ func newDeployCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "deploy", Use: "deploy",
Short: "Deploy bundle", Short: "Deploy bundle",
Args: cobra.NoArgs, Args: root.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/bundle/deploy/terraform" "github.com/databricks/cli/bundle/deploy/terraform"
"github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils" "github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -16,7 +17,7 @@ func newBindCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "bind KEY RESOURCE_ID", Use: "bind KEY RESOURCE_ID",
Short: "Bind bundle-defined resources to existing resources", Short: "Bind bundle-defined resources to existing resources",
Args: cobra.ExactArgs(2), Args: root.ExactArgs(2),
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -6,6 +6,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils" "github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -13,7 +14,7 @@ func newUnbindCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "unbind KEY", Use: "unbind KEY",
Short: "Unbind bundle-defined resources from its managed remote resource", Short: "Unbind bundle-defined resources from its managed remote resource",
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils" "github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -18,7 +19,7 @@ func newDestroyCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "destroy", Use: "destroy",
Short: "Destroy deployed bundle resources", Short: "Destroy deployed bundle resources",
Args: cobra.NoArgs, Args: root.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -128,7 +128,7 @@ func newInitCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "init [TEMPLATE_PATH]", Use: "init [TEMPLATE_PATH]",
Short: "Initialize using a bundle template", Short: "Initialize using a bundle template",
Args: cobra.MaximumNArgs(1), Args: root.MaximumNArgs(1),
Long: fmt.Sprintf(`Initialize using a bundle template. Long: fmt.Sprintf(`Initialize using a bundle template.
TEMPLATE_PATH optionally specifies which template to use. It can be one of the following: TEMPLATE_PATH optionally specifies which template to use. It can be one of the following:

View File

@ -12,7 +12,7 @@ func newLaunchCommand() *cobra.Command {
Use: "launch", Use: "launch",
Short: "Launches a notebook on development cluster", Short: "Launches a notebook on development cluster",
Long: `Reads a file and executes it on dev cluster`, Long: `Reads a file and executes it on dev cluster`,
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
// We're not ready to expose this command until we specify its semantics. // We're not ready to expose this command until we specify its semantics.
Hidden: true, Hidden: true,

View File

@ -19,7 +19,7 @@ func newRunCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "run [flags] KEY", Use: "run [flags] KEY",
Short: "Run a resource (e.g. a job or a pipeline)", Short: "Run a resource (e.g. a job or a pipeline)",
Args: cobra.MaximumNArgs(1), Args: root.MaximumNArgs(1),
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -6,6 +6,7 @@ import (
"github.com/databricks/cli/bundle/config" "github.com/databricks/cli/bundle/config"
"github.com/databricks/cli/bundle/schema" "github.com/databricks/cli/bundle/schema"
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -13,7 +14,7 @@ func newSchemaCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "schema", Use: "schema",
Short: "Generate JSON Schema for bundle configuration", Short: "Generate JSON Schema for bundle configuration",
Args: cobra.NoArgs, Args: root.NoArgs,
} }
cmd.RunE = func(cmd *cobra.Command, args []string) error { cmd.RunE = func(cmd *cobra.Command, args []string) error {

View File

@ -20,7 +20,7 @@ func newSummaryCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "summary", Use: "summary",
Short: "Describe the bundle resources and their deployment states", Short: "Describe the bundle resources and their deployment states",
Args: cobra.NoArgs, Args: root.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
// This command is currently intended for the Databricks VSCode extension only // This command is currently intended for the Databricks VSCode extension only

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils" "github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/log" "github.com/databricks/cli/libs/log"
"github.com/databricks/cli/libs/sync" "github.com/databricks/cli/libs/sync"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -47,7 +48,7 @@ func newSyncCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "sync [flags]", Use: "sync [flags]",
Short: "Synchronize bundle tree to the workspace", Short: "Synchronize bundle tree to the workspace",
Args: cobra.NoArgs, Args: root.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -6,6 +6,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils" "github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/log" "github.com/databricks/cli/libs/log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -14,7 +15,7 @@ func newValidateCommand() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "validate", Use: "validate",
Short: "Validate configuration", Short: "Validate configuration",
Args: cobra.NoArgs, Args: root.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables, PreRunE: utils.ConfigureBundleWithVariables,
} }

View File

@ -11,7 +11,7 @@ func newCatCommand() *cobra.Command {
Use: "cat FILE_PATH", Use: "cat FILE_PATH",
Short: "Show file content.", Short: "Show file content.",
Long: `Show the contents of a file in DBFS or a UC Volume.`, Long: `Show the contents of a file in DBFS or a UC Volume.`,
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
PreRunE: root.MustWorkspaceClient, PreRunE: root.MustWorkspaceClient,
} }

View File

@ -141,7 +141,7 @@ func newCpCommand() *cobra.Command {
When copying a file, if TARGET_PATH is a directory, the file will be created When copying a file, if TARGET_PATH is a directory, the file will be created
inside the directory, otherwise the file is created at TARGET_PATH. inside the directory, otherwise the file is created at TARGET_PATH.
`, `,
Args: cobra.ExactArgs(2), Args: root.ExactArgs(2),
PreRunE: root.MustWorkspaceClient, PreRunE: root.MustWorkspaceClient,
} }

View File

@ -42,7 +42,7 @@ func newLsCommand() *cobra.Command {
Use: "ls DIR_PATH", Use: "ls DIR_PATH",
Short: "Lists files.", Short: "Lists files.",
Long: `Lists files in DBFS and UC Volumes.`, Long: `Lists files in DBFS and UC Volumes.`,
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
PreRunE: root.MustWorkspaceClient, PreRunE: root.MustWorkspaceClient,
} }

View File

@ -13,7 +13,7 @@ func newMkdirCommand() *cobra.Command {
Aliases: []string{"mkdirs"}, Aliases: []string{"mkdirs"},
Short: "Make directories.", Short: "Make directories.",
Long: `Make directories in DBFS and UC Volumes. Mkdir will create directories along the path to the argument directory.`, Long: `Make directories in DBFS and UC Volumes. Mkdir will create directories along the path to the argument directory.`,
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
PreRunE: root.MustWorkspaceClient, PreRunE: root.MustWorkspaceClient,
} }

View File

@ -11,7 +11,7 @@ func newRmCommand() *cobra.Command {
Use: "rm PATH", Use: "rm PATH",
Short: "Remove files and directories.", Short: "Remove files and directories.",
Long: `Remove files and directories from DBFS and UC Volumes.`, Long: `Remove files and directories from DBFS and UC Volumes.`,
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
PreRunE: root.MustWorkspaceClient, PreRunE: root.MustWorkspaceClient,
} }

View File

@ -2,13 +2,14 @@ package labs
import ( import (
"github.com/databricks/cli/cmd/labs/project" "github.com/databricks/cli/cmd/labs/project"
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func newInstallCommand() *cobra.Command { func newInstallCommand() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "install NAME", Use: "install NAME",
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
Short: "Installs project", Short: "Installs project",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
inst, err := project.NewInstaller(cmd, args[0]) inst, err := project.NewInstaller(cmd, args[0])

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"github.com/databricks/cli/cmd/labs/project" "github.com/databricks/cli/cmd/labs/project"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -11,7 +12,7 @@ import (
func newShowCommand() *cobra.Command { func newShowCommand() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "show NAME", Use: "show NAME",
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
Short: "Shows information about the project", Short: "Shows information about the project",
Annotations: map[string]string{ Annotations: map[string]string{
"template": cmdio.Heredoc(` "template": cmdio.Heredoc(`

View File

@ -4,13 +4,14 @@ import (
"fmt" "fmt"
"github.com/databricks/cli/cmd/labs/project" "github.com/databricks/cli/cmd/labs/project"
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func newUninstallCommand() *cobra.Command { func newUninstallCommand() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "uninstall NAME", Use: "uninstall NAME",
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
Short: "Uninstalls project", Short: "Uninstalls project",
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
var names []string var names []string

View File

@ -2,13 +2,14 @@ package labs
import ( import (
"github.com/databricks/cli/cmd/labs/project" "github.com/databricks/cli/cmd/labs/project"
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func newUpgradeCommand() *cobra.Command { func newUpgradeCommand() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "upgrade NAME", Use: "upgrade NAME",
Args: cobra.ExactArgs(1), Args: root.ExactArgs(1),
Short: "Upgrades project", Short: "Upgrades project",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
inst, err := project.NewUpgrader(cmd, args[0]) inst, err := project.NewUpgrader(cmd, args[0])

45
cmd/root/args.go Normal file
View File

@ -0,0 +1,45 @@
package root
import (
"fmt"
"github.com/spf13/cobra"
)
type InvalidArgsError struct {
// The command that was run.
Command *cobra.Command
// The error message.
Message string
}
func (e *InvalidArgsError) Error() string {
return fmt.Sprintf("%s\n\n%s", e.Message, e.Command.UsageString())
}
func ExactArgs(n int) cobra.PositionalArgs {
return func(cmd *cobra.Command, args []string) error {
if len(args) != n {
return &InvalidArgsError{Message: fmt.Sprintf("accepts %d arg(s), received %d", n, len(args)), Command: cmd}
}
return nil
}
}
func NoArgs(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
msg := fmt.Sprintf("unknown command %q for %q", args[0], cmd.CommandPath())
return &InvalidArgsError{Message: msg, Command: cmd}
}
return nil
}
func MaximumNArgs(n int) cobra.PositionalArgs {
return func(cmd *cobra.Command, args []string) error {
if len(args) > n {
msg := fmt.Sprintf("accepts at most %d arg(s), received %d", n, len(args))
return &InvalidArgsError{Message: msg, Command: cmd}
}
return nil
}
}

View File

@ -78,7 +78,7 @@ func New() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "sync [flags] SRC DST", Use: "sync [flags] SRC DST",
Short: "Synchronize a local directory to a workspace directory", Short: "Synchronize a local directory to a workspace directory",
Args: cobra.MaximumNArgs(2), Args: root.MaximumNArgs(2),
GroupID: "development", GroupID: "development",
} }

View File

@ -1,6 +1,7 @@
package version package version
import ( import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/internal/build" "github.com/databricks/cli/internal/build"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -9,7 +10,7 @@ import (
func New() *cobra.Command { func New() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "version", Use: "version",
Args: cobra.NoArgs, Args: root.NoArgs,
Short: "Retrieve information about the current version of this CLI", Short: "Retrieve information about the current version of this CLI",
Annotations: map[string]string{ Annotations: map[string]string{
"template": "Databricks CLI v{{.Version}}\n", "template": "Databricks CLI v{{.Version}}\n",

View File

@ -317,7 +317,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -137,7 +137,7 @@ func newDeleteApp() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -195,7 +195,7 @@ func newGetApp() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -255,7 +255,7 @@ func newGetAppDeploymentStatus() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -355,7 +355,7 @@ func newGetEvents() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -70,7 +70,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -135,7 +135,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -63,7 +63,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -89,13 +89,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -164,7 +164,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -224,7 +224,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -336,7 +336,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -141,7 +141,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -202,7 +202,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -262,7 +262,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -334,7 +334,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -107,13 +107,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -183,7 +183,7 @@ func newDelete() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'policy_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'policy_id' in your JSON input")
} }
@ -283,13 +283,13 @@ func newEdit() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'policy_id', 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'policy_id', 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -569,7 +569,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -118,13 +118,13 @@ func newChangeOwner() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id', 'owner_username' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id', 'owner_username' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -253,13 +253,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'spark_version' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'spark_version' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -348,7 +348,7 @@ func newDelete() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -512,13 +512,13 @@ func newEdit() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id', 'spark_version' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id', 'spark_version' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -611,7 +611,7 @@ func newEvents() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -919,7 +919,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1066,7 +1066,7 @@ func newPermanentDelete() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -1158,7 +1158,7 @@ func newPin() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -1257,7 +1257,7 @@ func newResize() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -1367,7 +1367,7 @@ func newRestart() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -1605,7 +1605,7 @@ func newStart() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }
@ -1709,7 +1709,7 @@ func newUnpin() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input")
} }

View File

@ -331,7 +331,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -66,7 +66,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -128,7 +128,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -186,7 +186,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -274,7 +274,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -78,7 +78,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -133,7 +133,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -68,7 +68,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -114,13 +114,13 @@ func newCreateExperiment() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -193,7 +193,7 @@ func newCreateRun() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -261,13 +261,13 @@ func newDeleteExperiment() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -336,13 +336,13 @@ func newDeleteRun() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -419,13 +419,13 @@ func newDeleteRuns() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id', 'max_timestamp_millis' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id', 'max_timestamp_millis' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -502,13 +502,13 @@ func newDeleteTag() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id', 'key' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id', 'key' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -585,7 +585,7 @@ func newGetByName() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -643,7 +643,7 @@ func newGetExperiment() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -706,7 +706,7 @@ func newGetHistory() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -761,7 +761,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -820,7 +820,7 @@ func newGetPermissions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -885,7 +885,7 @@ func newGetRun() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -946,7 +946,7 @@ func newListArtifacts() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1000,7 +1000,7 @@ func newListExperiments() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1093,7 +1093,7 @@ func newLogBatch() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1159,7 +1159,7 @@ func newLogInputs() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1233,13 +1233,13 @@ func newLogMetric() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value', 'timestamp' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value', 'timestamp' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -1320,7 +1320,7 @@ func newLogModel() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1393,13 +1393,13 @@ func newLogParam() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -1476,13 +1476,13 @@ func newRestoreExperiment() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1551,13 +1551,13 @@ func newRestoreRun() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1634,13 +1634,13 @@ func newRestoreRuns() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id', 'min_timestamp_millis' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id', 'min_timestamp_millis' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -1717,7 +1717,7 @@ func newSearchExperiments() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1785,7 +1785,7 @@ func newSearchRuns() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1853,13 +1853,13 @@ func newSetExperimentTag() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id', 'key', 'value' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id', 'key', 'value' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -1936,7 +1936,7 @@ func newSetPermissions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2011,13 +2011,13 @@ func newSetTag() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -2091,13 +2091,13 @@ func newUpdateExperiment() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2168,7 +2168,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2236,7 +2236,7 @@ func newUpdateRun() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -95,13 +95,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'url', 'credential_name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'url', 'credential_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -176,7 +176,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -236,7 +236,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -299,7 +299,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -367,7 +367,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -304,7 +304,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -86,13 +86,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'git_provider' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'git_provider' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -85,13 +85,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'script' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'script' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -351,13 +351,13 @@ func newUpdate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only SCRIPT_ID as positional arguments. Provide 'name', 'script' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only SCRIPT_ID as positional arguments. Provide 'name', 'script' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -81,7 +81,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -146,7 +146,7 @@ func newGetEffective() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -213,7 +213,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -295,7 +295,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -112,13 +112,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_pool_name', 'node_type_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_pool_name', 'node_type_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -191,7 +191,7 @@ func newDelete() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_pool_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_pool_id' in your JSON input")
} }
@ -293,13 +293,13 @@ func newEdit() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_pool_id', 'instance_pool_name', 'node_type_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_pool_id', 'instance_pool_name', 'node_type_id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -83,13 +83,13 @@ func newAdd() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_profile_arn' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_profile_arn' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -176,13 +176,13 @@ func newEdit() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_profile_arn' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_profile_arn' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -295,13 +295,13 @@ func newRemove() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_profile_arn' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'instance_profile_arn' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -117,13 +117,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'label', 'list_type' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'label', 'list_type' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -398,13 +398,13 @@ func newReplace() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(4) check := root.ExactArgs(4)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -106,7 +106,7 @@ func newCancelAllRuns() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -178,7 +178,7 @@ func newCancelRun() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input")
} }
@ -349,7 +349,7 @@ func newDelete() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input")
} }
@ -442,7 +442,7 @@ func newDeleteRun() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input")
} }
@ -989,7 +989,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1050,7 +1050,7 @@ func newListRuns() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1127,7 +1127,7 @@ func newRepairRun() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input")
} }
@ -1316,7 +1316,7 @@ func newRunNow() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input")
} }
@ -1525,7 +1525,7 @@ func newSubmit() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1614,7 +1614,7 @@ func newUpdate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input")
} }

View File

@ -93,7 +93,7 @@ func newCancelRefresh() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -150,7 +150,7 @@ func newCreate() *cobra.Command {
// TODO: complex arg: schedule // TODO: complex arg: schedule
cmd.Flags().BoolVar(&createReq.SkipBuiltinDashboard, "skip-builtin-dashboard", createReq.SkipBuiltinDashboard, `Whether to skip creating a default dashboard summarizing data quality metrics.`) cmd.Flags().BoolVar(&createReq.SkipBuiltinDashboard, "skip-builtin-dashboard", createReq.SkipBuiltinDashboard, `Whether to skip creating a default dashboard summarizing data quality metrics.`)
// TODO: array: slicing_exprs // TODO: array: slicing_exprs
// TODO: complex arg: snapshot // TODO: output-only field
// TODO: complex arg: time_series // TODO: complex arg: time_series
cmd.Flags().StringVar(&createReq.WarehouseId, "warehouse-id", createReq.WarehouseId, `Optional argument to specify the warehouse for dashboard creation.`) cmd.Flags().StringVar(&createReq.WarehouseId, "warehouse-id", createReq.WarehouseId, `Optional argument to specify the warehouse for dashboard creation.`)
@ -179,13 +179,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only FULL_NAME as positional arguments. Provide 'assets_dir', 'output_schema_name' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only FULL_NAME as positional arguments. Provide 'assets_dir', 'output_schema_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -267,7 +267,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -336,7 +336,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -404,7 +404,7 @@ func newGetRefresh() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -473,7 +473,7 @@ func newListRefreshes() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -541,7 +541,7 @@ func newRunRefresh() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -596,7 +596,7 @@ func newUpdate() *cobra.Command {
// TODO: array: notifications // TODO: array: notifications
// TODO: complex arg: schedule // TODO: complex arg: schedule
// TODO: array: slicing_exprs // TODO: array: slicing_exprs
// TODO: complex arg: snapshot // TODO: output-only field
// TODO: complex arg: time_series // TODO: complex arg: time_series
cmd.Use = "update FULL_NAME OUTPUT_SCHEMA_NAME" cmd.Use = "update FULL_NAME OUTPUT_SCHEMA_NAME"
@ -625,13 +625,13 @@ func newUpdate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only FULL_NAME as positional arguments. Provide 'output_schema_name' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only FULL_NAME as positional arguments. Provide 'output_schema_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -70,7 +70,7 @@ func newPublish() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -146,7 +146,7 @@ func newClusterStatus() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -94,13 +94,13 @@ func newAssign() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only WORKSPACE_ID as positional arguments. Provide 'metastore_id', 'default_catalog_name' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only WORKSPACE_ID as positional arguments. Provide 'metastore_id', 'default_catalog_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -183,13 +183,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -525,7 +525,7 @@ func newUnassign() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -125,13 +125,13 @@ func newApproveTransitionRequest() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(4) check := root.ExactArgs(4)
return check(cmd, args) return check(cmd, args)
} }
@ -219,13 +219,13 @@ func newCreateComment() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'comment' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'comment' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -306,13 +306,13 @@ func newCreateModel() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -387,13 +387,13 @@ func newCreateModelVersion() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'source' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'source' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -477,13 +477,13 @@ func newCreateTransitionRequest() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -622,7 +622,7 @@ func newDeleteComment() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -680,7 +680,7 @@ func newDeleteModel() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -740,7 +740,7 @@ func newDeleteModelTag() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -800,7 +800,7 @@ func newDeleteModelVersion() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -862,7 +862,7 @@ func newDeleteModelVersionTag() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -937,7 +937,7 @@ func newDeleteTransitionRequest() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(4) check := root.ExactArgs(4)
return check(cmd, args) return check(cmd, args)
} }
@ -1002,7 +1002,7 @@ func newDeleteWebhook() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1063,13 +1063,13 @@ func newGetLatestVersions() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1136,7 +1136,7 @@ func newGetModel() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1195,7 +1195,7 @@ func newGetModelVersion() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -1255,7 +1255,7 @@ func newGetModelVersionDownloadUri() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -1314,7 +1314,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1373,7 +1373,7 @@ func newGetPermissions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1432,7 +1432,7 @@ func newListModels() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1486,7 +1486,7 @@ func newListTransitionRequests() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -1545,7 +1545,7 @@ func newListWebhooks() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1613,13 +1613,13 @@ func newRejectTransitionRequest() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -1699,13 +1699,13 @@ func newRenameModel() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -1773,7 +1773,7 @@ func newSearchModelVersions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1828,7 +1828,7 @@ func newSearchModels() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -1891,13 +1891,13 @@ func newSetModelTag() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'key', 'value' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'key', 'value' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -1980,13 +1980,13 @@ func newSetModelVersionTag() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'key', 'value' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'key', 'value' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(4) check := root.ExactArgs(4)
return check(cmd, args) return check(cmd, args)
} }
@ -2066,7 +2066,7 @@ func newSetPermissions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2150,13 +2150,13 @@ func newTestRegistryWebhook() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2243,13 +2243,13 @@ func newTransitionStage() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(4) check := root.ExactArgs(4)
return check(cmd, args) return check(cmd, args)
} }
@ -2334,13 +2334,13 @@ func newUpdateComment() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id', 'comment' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id', 'comment' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -2414,13 +2414,13 @@ func newUpdateModel() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2492,13 +2492,13 @@ func newUpdateModelVersion() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -2572,7 +2572,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -2647,13 +2647,13 @@ func newUpdateWebhook() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -83,7 +83,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -151,7 +151,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -219,7 +219,7 @@ func newGetByAlias() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -293,7 +293,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -360,7 +360,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -69,7 +69,7 @@ func newCreate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -134,7 +134,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -192,7 +192,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -80,13 +80,13 @@ func newMigratePermissions() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'workspace_id', 'from_workspace_group_name', 'to_account_group_name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'workspace_id', 'from_workspace_group_name', 'to_account_group_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -118,7 +118,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -178,7 +178,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -246,7 +246,7 @@ func newSet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -320,7 +320,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -432,7 +432,7 @@ func newGetUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -562,7 +562,7 @@ func newListPipelines() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -69,7 +69,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -127,7 +127,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -81,13 +81,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'authentication_type' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'authentication_type' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -304,7 +304,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -284,7 +284,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -67,7 +67,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -128,7 +128,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -186,7 +186,7 @@ func newUpdate() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -73,7 +73,7 @@ func newGetActivationUrlInfo() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }
@ -132,7 +132,7 @@ func newRetrieveToken() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -101,13 +101,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'authentication_type' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'authentication_type' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -324,7 +324,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -385,13 +385,13 @@ func newRotateToken() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(1)(cmd, args) err := root.ExactArgs(1)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'existing_token_expire_in_seconds' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'existing_token_expire_in_seconds' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -119,13 +119,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'catalog_name', 'schema_name', 'name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'catalog_name', 'schema_name', 'name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }
@ -279,7 +279,7 @@ func newDeleteAlias() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -426,7 +426,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -489,13 +489,13 @@ func newSetAlias() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(2)(cmd, args) err := root.ExactArgs(2)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, provide only FULL_NAME, ALIAS as positional arguments. Provide 'version_num' in your JSON input") return fmt.Errorf("when --json flag is specified, provide only FULL_NAME, ALIAS as positional arguments. Provide 'version_num' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(3) check := root.ExactArgs(3)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -25,7 +25,7 @@ func createOverride(createCmd *cobra.Command, createReq *workspace.CreateRepo) {
// If the provider argument is not specified, we try to detect it from the URL. // If the provider argument is not specified, we try to detect it from the URL.
check := cobra.RangeArgs(1, 2) check := cobra.RangeArgs(1, 2)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0) check = root.ExactArgs(0)
} }
return check(cmd, args) return check(cmd, args)
} }

View File

@ -94,13 +94,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'url', 'provider' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'url', 'provider' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -457,7 +457,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -78,7 +78,7 @@ func newDelete() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }
@ -133,7 +133,7 @@ func newGet() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := root.ExactArgs(0)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -84,13 +84,13 @@ func newCreate() *cobra.Command {
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err := cobra.ExactArgs(0)(cmd, args) err := root.ExactArgs(0)(cmd, args)
if err != nil { if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'catalog_name' in your JSON input") return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'catalog_name' in your JSON input")
} }
return nil return nil
} }
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -311,7 +311,7 @@ func newList() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1) check := root.ExactArgs(1)
return check(cmd, args) return check(cmd, args)
} }

View File

@ -50,9 +50,9 @@ func newPutSecret() *cobra.Command {
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := root.ExactArgs(2)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0) check = root.ExactArgs(0)
} }
return check(cmd, args) return check(cmd, args)
} }

Some files were not shown because too many files have changed in this diff Show More