From c7818560ca1c60a3324c190fa2b24e29c5acf8c2 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Tue, 12 Mar 2024 15:12:34 +0100 Subject: [PATCH] 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) ``` --- .codegen/service.go.tmpl | 4 +- bundle/schema/docs/bundle_descriptions.json | 24 ++--- cmd/account/access-control/access-control.go | 4 +- cmd/account/billable-usage/billable-usage.go | 2 +- cmd/account/budgets/budgets.go | 2 +- .../csp-enablement-account.go | 2 +- .../custom-app-integration.go | 6 +- .../encryption-keys/encryption-keys.go | 4 +- .../esm-enablement-account.go | 2 +- cmd/account/groups/groups.go | 4 +- .../ip-access-lists/ip-access-lists.go | 8 +- cmd/account/log-delivery/log-delivery.go | 8 +- .../metastore-assignments.go | 10 +- cmd/account/metastores/metastores.go | 8 +- .../network-connectivity.go | 20 ++-- cmd/account/networks/networks.go | 4 +- .../o-auth-published-apps.go | 2 +- .../personal-compute/personal-compute.go | 4 +- cmd/account/private-access/private-access.go | 8 +- .../published-app-integration.go | 8 +- .../service-principal-secrets.go | 6 +- .../service-principals/service-principals.go | 4 +- cmd/account/settings/settings.go | 3 + .../storage-credentials.go | 10 +- cmd/account/users/users.go | 4 +- cmd/account/vpc-endpoints/vpc-endpoints.go | 4 +- .../workspace-assignment.go | 8 +- cmd/account/workspaces/workspaces.go | 4 +- cmd/api/api.go | 3 +- cmd/bundle/deploy.go | 3 +- cmd/bundle/deployment/bind.go | 3 +- cmd/bundle/deployment/unbind.go | 3 +- cmd/bundle/destroy.go | 3 +- cmd/bundle/init.go | 2 +- cmd/bundle/launch.go | 2 +- cmd/bundle/run.go | 2 +- cmd/bundle/schema.go | 3 +- cmd/bundle/summary.go | 2 +- cmd/bundle/sync.go | 3 +- cmd/bundle/validate.go | 3 +- cmd/fs/cat.go | 2 +- cmd/fs/cp.go | 2 +- cmd/fs/ls.go | 2 +- cmd/fs/mkdir.go | 2 +- cmd/fs/rm.go | 2 +- cmd/labs/install.go | 3 +- cmd/labs/show.go | 3 +- cmd/labs/uninstall.go | 3 +- cmd/labs/upgrade.go | 3 +- cmd/root/args.go | 45 ++++++++ cmd/sync/sync.go | 2 +- cmd/version/version.go | 3 +- cmd/workspace/alerts/alerts.go | 2 +- cmd/workspace/apps/apps.go | 8 +- .../artifact-allowlists.go | 4 +- .../automatic-cluster-update.go | 2 +- cmd/workspace/catalogs/catalogs.go | 10 +- cmd/workspace/clean-rooms/clean-rooms.go | 8 +- .../cluster-policies/cluster-policies.go | 12 +-- cmd/workspace/clusters/clusters.go | 30 +++--- cmd/workspace/connections/connections.go | 2 +- .../csp-enablement/csp-enablement.go | 2 +- .../dashboard-widgets/dashboard-widgets.go | 4 +- cmd/workspace/dashboards/dashboards.go | 2 +- .../default-namespace/default-namespace.go | 4 +- .../esm-enablement/esm-enablement.go | 2 +- cmd/workspace/experiments/experiments.go | 86 +++++++-------- .../external-locations/external-locations.go | 12 +-- cmd/workspace/functions/functions.go | 2 +- .../git-credentials/git-credentials.go | 4 +- .../global-init-scripts.go | 8 +- cmd/workspace/grants/grants.go | 6 +- cmd/workspace/groups/groups.go | 4 +- .../instance-pools/instance-pools.go | 10 +- .../instance-profiles/instance-profiles.go | 12 +-- .../ip-access-lists/ip-access-lists.go | 8 +- cmd/workspace/jobs/jobs.go | 20 ++-- .../lakehouse-monitors/lakehouse-monitors.go | 24 ++--- cmd/workspace/lakeview/lakeview.go | 2 +- cmd/workspace/libraries/libraries.go | 2 +- cmd/workspace/metastores/metastores.go | 10 +- .../model-registry/model-registry.go | 102 +++++++++--------- .../model-versions/model-versions.go | 10 +- cmd/workspace/online-tables/online-tables.go | 6 +- .../permission-migration.go | 4 +- cmd/workspace/permissions/permissions.go | 8 +- cmd/workspace/pipelines/pipelines.go | 4 +- .../policy-families/policy-families.go | 4 +- cmd/workspace/providers/providers.go | 6 +- cmd/workspace/queries/queries.go | 2 +- cmd/workspace/query-history/query-history.go | 2 +- .../query-visualizations.go | 4 +- .../recipient-activation.go | 4 +- cmd/workspace/recipients/recipients.go | 10 +- .../registered-models/registered-models.go | 12 +-- cmd/workspace/repos/overrides.go | 2 +- cmd/workspace/repos/repos.go | 6 +- .../restrict-workspace-admins.go | 4 +- cmd/workspace/schemas/schemas.go | 6 +- cmd/workspace/secrets/put_secret.go | 4 +- cmd/workspace/secrets/secrets.go | 28 ++--- .../service-principals/service-principals.go | 4 +- .../serving-endpoints/serving-endpoints.go | 26 ++--- cmd/workspace/settings/settings.go | 3 + cmd/workspace/shares/shares.go | 14 +-- .../storage-credentials.go | 14 +-- .../system-schemas/system-schemas.go | 6 +- .../table-constraints/table-constraints.go | 2 +- cmd/workspace/tables/tables.go | 2 +- .../token-management/token-management.go | 8 +- cmd/workspace/tokens/tokens.go | 4 +- cmd/workspace/users/users.go | 8 +- .../vector-search-endpoints.go | 10 +- .../vector-search-indexes.go | 20 ++-- cmd/workspace/volumes/volumes.go | 6 +- cmd/workspace/warehouses/warehouses.go | 6 +- .../workspace-bindings/workspace-bindings.go | 8 +- .../workspace-conf/workspace-conf.go | 2 +- cmd/workspace/workspace/export_dir.go | 2 +- cmd/workspace/workspace/import_dir.go | 2 +- cmd/workspace/workspace/workspace.go | 20 ++-- internal/clusters_test.go | 2 +- internal/secrets_test.go | 2 +- internal/workspace_test.go | 4 +- 124 files changed, 525 insertions(+), 461 deletions(-) create mode 100644 cmd/root/args.go diff --git a/.codegen/service.go.tmpl b/.codegen/service.go.tmpl index 0665b661..4887a623 100644 --- a/.codegen/service.go.tmpl +++ b/.codegen/service.go.tmpl @@ -194,7 +194,7 @@ func new{{.PascalName}}() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { {{- if $hasDifferentArgsWithJsonFlag }} 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 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") @@ -206,7 +206,7 @@ func new{{.PascalName}}() *cobra.Command { } {{- end }} {{- if $hasRequiredArgs }} - check := cobra.ExactArgs({{len .RequiredPositionalArguments}}) + check := root.ExactArgs({{len .RequiredPositionalArguments}}) return check(cmd, args) {{- else}} return nil diff --git a/bundle/schema/docs/bundle_descriptions.json b/bundle/schema/docs/bundle_descriptions.json index 494c8c75..d107af73 100644 --- a/bundle/schema/docs/bundle_descriptions.json +++ b/bundle/schema/docs/bundle_descriptions.json @@ -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." }, "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": { "apply_policy_default_values": { "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." }, "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": { "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." }, "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": { "apply_policy_default_values": { "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" }, "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." }, "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." }, "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." }, "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": { "apply_policy_default_values": { "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." }, "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": { "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." }, "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": { "apply_policy_default_values": { "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" }, "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." }, "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." }, "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" } } }, diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index 76ad4b51..f6761a1b 100755 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -72,7 +72,7 @@ func newGetAssignableRolesForResource() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -140,7 +140,7 @@ func newGetRuleSet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/account/billable-usage/billable-usage.go b/cmd/account/billable-usage/billable-usage.go index d8d36bac..2a2cca60 100755 --- a/cmd/account/billable-usage/billable-usage.go +++ b/cmd/account/billable-usage/billable-usage.go @@ -78,7 +78,7 @@ func newDownload() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/account/budgets/budgets.go b/cmd/account/budgets/budgets.go index e6f87a95..82f7b9f0 100755 --- a/cmd/account/budgets/budgets.go +++ b/cmd/account/budgets/budgets.go @@ -317,7 +317,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/csp-enablement-account/csp-enablement-account.go b/cmd/account/csp-enablement-account/csp-enablement-account.go index ca2170fa..5c7b9b92 100755 --- a/cmd/account/csp-enablement-account/csp-enablement-account.go +++ b/cmd/account/csp-enablement-account/csp-enablement-account.go @@ -68,7 +68,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/custom-app-integration/custom-app-integration.go b/cmd/account/custom-app-integration/custom-app-integration.go index 79dd50c1..ca9f69a3 100755 --- a/cmd/account/custom-app-integration/custom-app-integration.go +++ b/cmd/account/custom-app-integration/custom-app-integration.go @@ -139,7 +139,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -197,7 +197,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -301,7 +301,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/encryption-keys/encryption-keys.go b/cmd/account/encryption-keys/encryption-keys.go index c82f385e..44545ccf 100755 --- a/cmd/account/encryption-keys/encryption-keys.go +++ b/cmd/account/encryption-keys/encryption-keys.go @@ -163,7 +163,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -235,7 +235,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/esm-enablement-account/esm-enablement-account.go b/cmd/account/esm-enablement-account/esm-enablement-account.go index fc793d60..0c936c4d 100755 --- a/cmd/account/esm-enablement-account/esm-enablement-account.go +++ b/cmd/account/esm-enablement-account/esm-enablement-account.go @@ -66,7 +66,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/groups/groups.go b/cmd/account/groups/groups.go index 68ae1b2a..a7e1ac43 100755 --- a/cmd/account/groups/groups.go +++ b/cmd/account/groups/groups.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -295,7 +295,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/ip-access-lists/ip-access-lists.go b/cmd/account/ip-access-lists/ip-access-lists.go index 364c5a91..5c6d27dd 100755 --- a/cmd/account/ip-access-lists/ip-access-lists.go +++ b/cmd/account/ip-access-lists/ip-access-lists.go @@ -116,13 +116,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -395,13 +395,13 @@ func newReplace() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } diff --git a/cmd/account/log-delivery/log-delivery.go b/cmd/account/log-delivery/log-delivery.go index f51573e9..4584f4d2 100755 --- a/cmd/account/log-delivery/log-delivery.go +++ b/cmd/account/log-delivery/log-delivery.go @@ -152,7 +152,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -288,7 +288,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -353,13 +353,13 @@ func newPatchStatus() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/account/metastore-assignments/metastore-assignments.go b/cmd/account/metastore-assignments/metastore-assignments.go index 013d25cf..d7f32ccb 100755 --- a/cmd/account/metastore-assignments/metastore-assignments.go +++ b/cmd/account/metastore-assignments/metastore-assignments.go @@ -75,7 +75,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -145,7 +145,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -210,7 +210,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -272,7 +272,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -333,7 +333,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/account/metastores/metastores.go b/cmd/account/metastores/metastores.go index bcccff81..7c8e3f2c 100755 --- a/cmd/account/metastores/metastores.go +++ b/cmd/account/metastores/metastores.go @@ -70,7 +70,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -135,7 +135,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -193,7 +193,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -294,7 +294,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/network-connectivity/network-connectivity.go b/cmd/account/network-connectivity/network-connectivity.go index fbde0694..2b6cf54a 100755 --- a/cmd/account/network-connectivity/network-connectivity.go +++ b/cmd/account/network-connectivity/network-connectivity.go @@ -80,13 +80,13 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'region' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -171,13 +171,13 @@ func newCreatePrivateEndpointRule() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -250,7 +250,7 @@ func newDeleteNetworkConnectivityConfiguration() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -313,7 +313,7 @@ func newDeletePrivateEndpointRule() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -372,7 +372,7 @@ func newGetNetworkConnectivityConfiguration() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -431,7 +431,7 @@ func newGetPrivateEndpointRule() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -489,7 +489,7 @@ func newListNetworkConnectivityConfigurations() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -544,7 +544,7 @@ func newListPrivateEndpointRules() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/networks/networks.go b/cmd/account/networks/networks.go index 6dc77297..05ef0c81 100755 --- a/cmd/account/networks/networks.go +++ b/cmd/account/networks/networks.go @@ -81,13 +81,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'network_name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/o-auth-published-apps/o-auth-published-apps.go b/cmd/account/o-auth-published-apps/o-auth-published-apps.go index a9e94e5a..6573b052 100755 --- a/cmd/account/o-auth-published-apps/o-auth-published-apps.go +++ b/cmd/account/o-auth-published-apps/o-auth-published-apps.go @@ -66,7 +66,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/personal-compute/personal-compute.go b/cmd/account/personal-compute/personal-compute.go index 79090faf..7a2a0452 100755 --- a/cmd/account/personal-compute/personal-compute.go +++ b/cmd/account/personal-compute/personal-compute.go @@ -74,7 +74,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -129,7 +129,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/private-access/private-access.go b/cmd/account/private-access/private-access.go index 4641223c..d527fa64 100755 --- a/cmd/account/private-access/private-access.go +++ b/cmd/account/private-access/private-access.go @@ -93,13 +93,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -395,13 +395,13 @@ func newReplace() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/account/published-app-integration/published-app-integration.go b/cmd/account/published-app-integration/published-app-integration.go index 8befd39b..32fed5cd 100755 --- a/cmd/account/published-app-integration/published-app-integration.go +++ b/cmd/account/published-app-integration/published-app-integration.go @@ -75,7 +75,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -139,7 +139,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -197,7 +197,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -300,7 +300,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/service-principal-secrets/service-principal-secrets.go b/cmd/account/service-principal-secrets/service-principal-secrets.go index 0239df66..47cfa4b0 100755 --- a/cmd/account/service-principal-secrets/service-principal-secrets.go +++ b/cmd/account/service-principal-secrets/service-principal-secrets.go @@ -79,7 +79,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -141,7 +141,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -205,7 +205,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/service-principals/service-principals.go b/cmd/account/service-principals/service-principals.go index b9ad194c..c86810f1 100755 --- a/cmd/account/service-principals/service-principals.go +++ b/cmd/account/service-principals/service-principals.go @@ -85,7 +85,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -294,7 +294,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/settings/settings.go b/cmd/account/settings/settings.go index a750e81e..29bb6ad1 100755 --- a/cmd/account/settings/settings.go +++ b/cmd/account/settings/settings.go @@ -23,6 +23,9 @@ func New() *cobra.Command { Annotations: map[string]string{ "package": "settings", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // Add subservices diff --git a/cmd/account/storage-credentials/storage-credentials.go b/cmd/account/storage-credentials/storage-credentials.go index 61f8521b..0a20b86b 100755 --- a/cmd/account/storage-credentials/storage-credentials.go +++ b/cmd/account/storage-credentials/storage-credentials.go @@ -78,7 +78,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -146,7 +146,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -208,7 +208,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -268,7 +268,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -333,7 +333,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/account/users/users.go b/cmd/account/users/users.go index ab4bd95b..289d2972 100755 --- a/cmd/account/users/users.go +++ b/cmd/account/users/users.go @@ -93,7 +93,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -310,7 +310,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/account/vpc-endpoints/vpc-endpoints.go b/cmd/account/vpc-endpoints/vpc-endpoints.go index 0c15ca9c..e6c6c126 100755 --- a/cmd/account/vpc-endpoints/vpc-endpoints.go +++ b/cmd/account/vpc-endpoints/vpc-endpoints.go @@ -88,13 +88,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/account/workspace-assignment/workspace-assignment.go b/cmd/account/workspace-assignment/workspace-assignment.go index 20f88524..935d64f0 100755 --- a/cmd/account/workspace-assignment/workspace-assignment.go +++ b/cmd/account/workspace-assignment/workspace-assignment.go @@ -72,7 +72,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -137,7 +137,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -199,7 +199,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -261,7 +261,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/account/workspaces/workspaces.go b/cmd/account/workspaces/workspaces.go index 2cc0cb1a..1ec6230b 100755 --- a/cmd/account/workspaces/workspaces.go +++ b/cmd/account/workspaces/workspaces.go @@ -117,13 +117,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'workspace_name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/api/api.go b/cmd/api/api.go index 11a5e3e3..03460f71 100644 --- a/cmd/api/api.go +++ b/cmd/api/api.go @@ -5,6 +5,7 @@ import ( "net/http" "strings" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" "github.com/databricks/databricks-sdk-go/client" @@ -35,7 +36,7 @@ func makeCommand(method string) *cobra.Command { command := &cobra.Command{ Use: strings.ToLower(method), - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), Short: fmt.Sprintf("Perform %s request", method), RunE: func(cmd *cobra.Command, args []string) error { var path = args[0] diff --git a/cmd/bundle/deploy.go b/cmd/bundle/deploy.go index 60426eca..0ba8a187 100644 --- a/cmd/bundle/deploy.go +++ b/cmd/bundle/deploy.go @@ -6,6 +6,7 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/cmd/bundle/utils" + "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) @@ -13,7 +14,7 @@ func newDeployCommand() *cobra.Command { cmd := &cobra.Command{ Use: "deploy", Short: "Deploy bundle", - Args: cobra.NoArgs, + Args: root.NoArgs, PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/bundle/deployment/bind.go b/cmd/bundle/deployment/bind.go index 1287eb04..184cac1d 100644 --- a/cmd/bundle/deployment/bind.go +++ b/cmd/bundle/deployment/bind.go @@ -8,6 +8,7 @@ import ( "github.com/databricks/cli/bundle/deploy/terraform" "github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/cmd/bundle/utils" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ func newBindCommand() *cobra.Command { cmd := &cobra.Command{ Use: "bind KEY RESOURCE_ID", Short: "Bind bundle-defined resources to existing resources", - Args: cobra.ExactArgs(2), + Args: root.ExactArgs(2), PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/bundle/deployment/unbind.go b/cmd/bundle/deployment/unbind.go index 9f0e4f7c..b5fb6920 100644 --- a/cmd/bundle/deployment/unbind.go +++ b/cmd/bundle/deployment/unbind.go @@ -6,6 +6,7 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/cmd/bundle/utils" + "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) @@ -13,7 +14,7 @@ func newUnbindCommand() *cobra.Command { cmd := &cobra.Command{ Use: "unbind KEY", Short: "Unbind bundle-defined resources from its managed remote resource", - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/bundle/destroy.go b/cmd/bundle/destroy.go index b27161f9..dc5ea45f 100644 --- a/cmd/bundle/destroy.go +++ b/cmd/bundle/destroy.go @@ -8,6 +8,7 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/cmd/bundle/utils" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" "github.com/spf13/cobra" @@ -18,7 +19,7 @@ func newDestroyCommand() *cobra.Command { cmd := &cobra.Command{ Use: "destroy", Short: "Destroy deployed bundle resources", - Args: cobra.NoArgs, + Args: root.NoArgs, PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/bundle/init.go b/cmd/bundle/init.go index 704bad64..6845ab67 100644 --- a/cmd/bundle/init.go +++ b/cmd/bundle/init.go @@ -128,7 +128,7 @@ func newInitCommand() *cobra.Command { cmd := &cobra.Command{ Use: "init [TEMPLATE_PATH]", Short: "Initialize using a bundle template", - Args: cobra.MaximumNArgs(1), + Args: root.MaximumNArgs(1), Long: fmt.Sprintf(`Initialize using a bundle template. TEMPLATE_PATH optionally specifies which template to use. It can be one of the following: diff --git a/cmd/bundle/launch.go b/cmd/bundle/launch.go index bbb43600..f376ebda 100644 --- a/cmd/bundle/launch.go +++ b/cmd/bundle/launch.go @@ -12,7 +12,7 @@ func newLaunchCommand() *cobra.Command { Use: "launch", Short: "Launches a notebook on development 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. Hidden: true, diff --git a/cmd/bundle/run.go b/cmd/bundle/run.go index 8814bee0..9b4ad5c8 100644 --- a/cmd/bundle/run.go +++ b/cmd/bundle/run.go @@ -19,7 +19,7 @@ func newRunCommand() *cobra.Command { cmd := &cobra.Command{ Use: "run [flags] KEY", Short: "Run a resource (e.g. a job or a pipeline)", - Args: cobra.MaximumNArgs(1), + Args: root.MaximumNArgs(1), PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/bundle/schema.go b/cmd/bundle/schema.go index eb0c1fc9..0f27142b 100644 --- a/cmd/bundle/schema.go +++ b/cmd/bundle/schema.go @@ -6,6 +6,7 @@ import ( "github.com/databricks/cli/bundle/config" "github.com/databricks/cli/bundle/schema" + "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) @@ -13,7 +14,7 @@ func newSchemaCommand() *cobra.Command { cmd := &cobra.Command{ Use: "schema", Short: "Generate JSON Schema for bundle configuration", - Args: cobra.NoArgs, + Args: root.NoArgs, } cmd.RunE = func(cmd *cobra.Command, args []string) error { diff --git a/cmd/bundle/summary.go b/cmd/bundle/summary.go index 8b475661..68354a0a 100644 --- a/cmd/bundle/summary.go +++ b/cmd/bundle/summary.go @@ -20,7 +20,7 @@ func newSummaryCommand() *cobra.Command { cmd := &cobra.Command{ Use: "summary", Short: "Describe the bundle resources and their deployment states", - Args: cobra.NoArgs, + Args: root.NoArgs, PreRunE: utils.ConfigureBundleWithVariables, // This command is currently intended for the Databricks VSCode extension only diff --git a/cmd/bundle/sync.go b/cmd/bundle/sync.go index d9f8582c..20ec2fcd 100644 --- a/cmd/bundle/sync.go +++ b/cmd/bundle/sync.go @@ -7,6 +7,7 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/cmd/bundle/utils" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/log" "github.com/databricks/cli/libs/sync" "github.com/spf13/cobra" @@ -47,7 +48,7 @@ func newSyncCommand() *cobra.Command { cmd := &cobra.Command{ Use: "sync [flags]", Short: "Synchronize bundle tree to the workspace", - Args: cobra.NoArgs, + Args: root.NoArgs, PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/bundle/validate.go b/cmd/bundle/validate.go index 9a5bf1e9..a650fcfd 100644 --- a/cmd/bundle/validate.go +++ b/cmd/bundle/validate.go @@ -6,6 +6,7 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/phases" "github.com/databricks/cli/cmd/bundle/utils" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/log" "github.com/spf13/cobra" ) @@ -14,7 +15,7 @@ func newValidateCommand() *cobra.Command { cmd := &cobra.Command{ Use: "validate", Short: "Validate configuration", - Args: cobra.NoArgs, + Args: root.NoArgs, PreRunE: utils.ConfigureBundleWithVariables, } diff --git a/cmd/fs/cat.go b/cmd/fs/cat.go index df94d1d7..7a6f42cb 100644 --- a/cmd/fs/cat.go +++ b/cmd/fs/cat.go @@ -11,7 +11,7 @@ func newCatCommand() *cobra.Command { Use: "cat FILE_PATH", Short: "Show file content.", Long: `Show the contents of a file in DBFS or a UC Volume.`, - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), PreRunE: root.MustWorkspaceClient, } diff --git a/cmd/fs/cp.go b/cmd/fs/cp.go index 1ba0daf0..52feb890 100644 --- a/cmd/fs/cp.go +++ b/cmd/fs/cp.go @@ -141,7 +141,7 @@ func newCpCommand() *cobra.Command { 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. `, - Args: cobra.ExactArgs(2), + Args: root.ExactArgs(2), PreRunE: root.MustWorkspaceClient, } diff --git a/cmd/fs/ls.go b/cmd/fs/ls.go index 1d9ee876..cec9b98b 100644 --- a/cmd/fs/ls.go +++ b/cmd/fs/ls.go @@ -42,7 +42,7 @@ func newLsCommand() *cobra.Command { Use: "ls DIR_PATH", Short: "Lists files.", Long: `Lists files in DBFS and UC Volumes.`, - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), PreRunE: root.MustWorkspaceClient, } diff --git a/cmd/fs/mkdir.go b/cmd/fs/mkdir.go index dc054d8a..074a7543 100644 --- a/cmd/fs/mkdir.go +++ b/cmd/fs/mkdir.go @@ -13,7 +13,7 @@ func newMkdirCommand() *cobra.Command { Aliases: []string{"mkdirs"}, Short: "Make directories.", 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, } diff --git a/cmd/fs/rm.go b/cmd/fs/rm.go index 8a7b6571..5f2904e7 100644 --- a/cmd/fs/rm.go +++ b/cmd/fs/rm.go @@ -11,7 +11,7 @@ func newRmCommand() *cobra.Command { Use: "rm PATH", Short: "Remove files and directories.", Long: `Remove files and directories from DBFS and UC Volumes.`, - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), PreRunE: root.MustWorkspaceClient, } diff --git a/cmd/labs/install.go b/cmd/labs/install.go index 31db4389..6ed6b2e9 100644 --- a/cmd/labs/install.go +++ b/cmd/labs/install.go @@ -2,13 +2,14 @@ package labs import ( "github.com/databricks/cli/cmd/labs/project" + "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) func newInstallCommand() *cobra.Command { return &cobra.Command{ Use: "install NAME", - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), Short: "Installs project", RunE: func(cmd *cobra.Command, args []string) error { inst, err := project.NewInstaller(cmd, args[0]) diff --git a/cmd/labs/show.go b/cmd/labs/show.go index 1ae6498c..c36f0bda 100644 --- a/cmd/labs/show.go +++ b/cmd/labs/show.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/databricks/cli/cmd/labs/project" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/spf13/cobra" ) @@ -11,7 +12,7 @@ import ( func newShowCommand() *cobra.Command { return &cobra.Command{ Use: "show NAME", - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), Short: "Shows information about the project", Annotations: map[string]string{ "template": cmdio.Heredoc(` diff --git a/cmd/labs/uninstall.go b/cmd/labs/uninstall.go index b2c83fff..424df38d 100644 --- a/cmd/labs/uninstall.go +++ b/cmd/labs/uninstall.go @@ -4,13 +4,14 @@ import ( "fmt" "github.com/databricks/cli/cmd/labs/project" + "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) func newUninstallCommand() *cobra.Command { return &cobra.Command{ Use: "uninstall NAME", - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), Short: "Uninstalls project", ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { var names []string diff --git a/cmd/labs/upgrade.go b/cmd/labs/upgrade.go index 88b7bc92..d0a8dec9 100644 --- a/cmd/labs/upgrade.go +++ b/cmd/labs/upgrade.go @@ -2,13 +2,14 @@ package labs import ( "github.com/databricks/cli/cmd/labs/project" + "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) func newUpgradeCommand() *cobra.Command { return &cobra.Command{ Use: "upgrade NAME", - Args: cobra.ExactArgs(1), + Args: root.ExactArgs(1), Short: "Upgrades project", RunE: func(cmd *cobra.Command, args []string) error { inst, err := project.NewUpgrader(cmd, args[0]) diff --git a/cmd/root/args.go b/cmd/root/args.go new file mode 100644 index 00000000..800d6add --- /dev/null +++ b/cmd/root/args.go @@ -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 + } +} diff --git a/cmd/sync/sync.go b/cmd/sync/sync.go index c613e8ca..f08d3d61 100644 --- a/cmd/sync/sync.go +++ b/cmd/sync/sync.go @@ -78,7 +78,7 @@ func New() *cobra.Command { cmd := &cobra.Command{ Use: "sync [flags] SRC DST", Short: "Synchronize a local directory to a workspace directory", - Args: cobra.MaximumNArgs(2), + Args: root.MaximumNArgs(2), GroupID: "development", } diff --git a/cmd/version/version.go b/cmd/version/version.go index 653fbb89..98881b91 100644 --- a/cmd/version/version.go +++ b/cmd/version/version.go @@ -1,6 +1,7 @@ package version import ( + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/internal/build" "github.com/databricks/cli/libs/cmdio" "github.com/spf13/cobra" @@ -9,7 +10,7 @@ import ( func New() *cobra.Command { cmd := &cobra.Command{ Use: "version", - Args: cobra.NoArgs, + Args: root.NoArgs, Short: "Retrieve information about the current version of this CLI", Annotations: map[string]string{ "template": "Databricks CLI v{{.Version}}\n", diff --git a/cmd/workspace/alerts/alerts.go b/cmd/workspace/alerts/alerts.go index 695fa6a9..d4a7d02a 100755 --- a/cmd/workspace/alerts/alerts.go +++ b/cmd/workspace/alerts/alerts.go @@ -317,7 +317,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/apps/apps.go b/cmd/workspace/apps/apps.go index 691584db..1ea50e83 100755 --- a/cmd/workspace/apps/apps.go +++ b/cmd/workspace/apps/apps.go @@ -137,7 +137,7 @@ func newDeleteApp() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -195,7 +195,7 @@ func newGetApp() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -255,7 +255,7 @@ func newGetAppDeploymentStatus() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -355,7 +355,7 @@ func newGetEvents() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/artifact-allowlists/artifact-allowlists.go b/cmd/workspace/artifact-allowlists/artifact-allowlists.go index 329ca9c3..fc25e3cb 100755 --- a/cmd/workspace/artifact-allowlists/artifact-allowlists.go +++ b/cmd/workspace/artifact-allowlists/artifact-allowlists.go @@ -70,7 +70,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -135,7 +135,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go index 4c6e643d..4e198eb4 100755 --- a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go +++ b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go @@ -63,7 +63,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/catalogs/catalogs.go b/cmd/workspace/catalogs/catalogs.go index b0876942..0d0989b9 100755 --- a/cmd/workspace/catalogs/catalogs.go +++ b/cmd/workspace/catalogs/catalogs.go @@ -89,13 +89,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -164,7 +164,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -224,7 +224,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -336,7 +336,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/clean-rooms/clean-rooms.go b/cmd/workspace/clean-rooms/clean-rooms.go index 33facfb9..9466c4b9 100755 --- a/cmd/workspace/clean-rooms/clean-rooms.go +++ b/cmd/workspace/clean-rooms/clean-rooms.go @@ -141,7 +141,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -202,7 +202,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -262,7 +262,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -334,7 +334,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/cluster-policies/cluster-policies.go b/cmd/workspace/cluster-policies/cluster-policies.go index 15a75b1f..8129db47 100755 --- a/cmd/workspace/cluster-policies/cluster-policies.go +++ b/cmd/workspace/cluster-policies/cluster-policies.go @@ -107,13 +107,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -183,7 +183,7 @@ func newDelete() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -569,7 +569,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/clusters/clusters.go b/cmd/workspace/clusters/clusters.go index 8d773755..70afc609 100755 --- a/cmd/workspace/clusters/clusters.go +++ b/cmd/workspace/clusters/clusters.go @@ -118,13 +118,13 @@ func newChangeOwner() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -253,13 +253,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'spark_version' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -348,7 +348,7 @@ func newDelete() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -611,7 +611,7 @@ func newEvents() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1066,7 +1066,7 @@ func newPermanentDelete() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cluster_id' in your JSON input") } diff --git a/cmd/workspace/connections/connections.go b/cmd/workspace/connections/connections.go index 87ec52be..bdb26668 100755 --- a/cmd/workspace/connections/connections.go +++ b/cmd/workspace/connections/connections.go @@ -331,7 +331,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/csp-enablement/csp-enablement.go b/cmd/workspace/csp-enablement/csp-enablement.go index 5e037f2a..623a7e54 100755 --- a/cmd/workspace/csp-enablement/csp-enablement.go +++ b/cmd/workspace/csp-enablement/csp-enablement.go @@ -66,7 +66,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/dashboard-widgets/dashboard-widgets.go b/cmd/workspace/dashboard-widgets/dashboard-widgets.go index 90463dd0..02b13739 100755 --- a/cmd/workspace/dashboard-widgets/dashboard-widgets.go +++ b/cmd/workspace/dashboard-widgets/dashboard-widgets.go @@ -128,7 +128,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -186,7 +186,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/dashboards/dashboards.go b/cmd/workspace/dashboards/dashboards.go index 3020cb60..0500ebec 100755 --- a/cmd/workspace/dashboards/dashboards.go +++ b/cmd/workspace/dashboards/dashboards.go @@ -274,7 +274,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/default-namespace/default-namespace.go b/cmd/workspace/default-namespace/default-namespace.go index 38880dd5..89c11d7c 100755 --- a/cmd/workspace/default-namespace/default-namespace.go +++ b/cmd/workspace/default-namespace/default-namespace.go @@ -78,7 +78,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -133,7 +133,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/esm-enablement/esm-enablement.go b/cmd/workspace/esm-enablement/esm-enablement.go index a3da246f..be0eed2f 100755 --- a/cmd/workspace/esm-enablement/esm-enablement.go +++ b/cmd/workspace/esm-enablement/esm-enablement.go @@ -68,7 +68,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index 50337390..e1e00380 100755 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -114,13 +114,13 @@ func newCreateExperiment() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -193,7 +193,7 @@ func newCreateRun() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -261,13 +261,13 @@ func newDeleteExperiment() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -336,13 +336,13 @@ func newDeleteRun() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -419,13 +419,13 @@ func newDeleteRuns() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -502,13 +502,13 @@ func newDeleteTag() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -585,7 +585,7 @@ func newGetByName() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -643,7 +643,7 @@ func newGetExperiment() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -706,7 +706,7 @@ func newGetHistory() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -761,7 +761,7 @@ func newGetPermissionLevels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -820,7 +820,7 @@ func newGetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -885,7 +885,7 @@ func newGetRun() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -946,7 +946,7 @@ func newListArtifacts() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1000,7 +1000,7 @@ func newListExperiments() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1093,7 +1093,7 @@ func newLogBatch() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1159,7 +1159,7 @@ func newLogInputs() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1233,13 +1233,13 @@ func newLogMetric() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -1320,7 +1320,7 @@ func newLogModel() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1393,13 +1393,13 @@ func newLogParam() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -1476,13 +1476,13 @@ func newRestoreExperiment() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1551,13 +1551,13 @@ func newRestoreRun() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'run_id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1634,13 +1634,13 @@ func newRestoreRuns() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -1717,7 +1717,7 @@ func newSearchExperiments() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1785,7 +1785,7 @@ func newSearchRuns() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1853,13 +1853,13 @@ func newSetExperimentTag() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -1936,7 +1936,7 @@ func newSetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2011,13 +2011,13 @@ func newSetTag() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'key', 'value' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -2091,13 +2091,13 @@ func newUpdateExperiment() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'experiment_id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2168,7 +2168,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2236,7 +2236,7 @@ func newUpdateRun() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index 76e46005..a123507c 100755 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -95,13 +95,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -176,7 +176,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -236,7 +236,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -299,7 +299,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -367,7 +367,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/functions/functions.go b/cmd/workspace/functions/functions.go index 5b1b9024..e4de29b5 100755 --- a/cmd/workspace/functions/functions.go +++ b/cmd/workspace/functions/functions.go @@ -304,7 +304,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/git-credentials/git-credentials.go b/cmd/workspace/git-credentials/git-credentials.go index ca8a1c27..c335d4ca 100755 --- a/cmd/workspace/git-credentials/git-credentials.go +++ b/cmd/workspace/git-credentials/git-credentials.go @@ -86,13 +86,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'git_provider' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/global-init-scripts/global-init-scripts.go b/cmd/workspace/global-init-scripts/global-init-scripts.go index 0461b451..92dcb259 100755 --- a/cmd/workspace/global-init-scripts/global-init-scripts.go +++ b/cmd/workspace/global-init-scripts/global-init-scripts.go @@ -85,13 +85,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'script' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -351,13 +351,13 @@ func newUpdate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/workspace/grants/grants.go b/cmd/workspace/grants/grants.go index 851c3cfb..876f0343 100755 --- a/cmd/workspace/grants/grants.go +++ b/cmd/workspace/grants/grants.go @@ -81,7 +81,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -146,7 +146,7 @@ func newGetEffective() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -213,7 +213,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/groups/groups.go b/cmd/workspace/groups/groups.go index 2fc63220..14650d98 100755 --- a/cmd/workspace/groups/groups.go +++ b/cmd/workspace/groups/groups.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -295,7 +295,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/instance-pools/instance-pools.go b/cmd/workspace/instance-pools/instance-pools.go index 8000365b..db96f146 100755 --- a/cmd/workspace/instance-pools/instance-pools.go +++ b/cmd/workspace/instance-pools/instance-pools.go @@ -112,13 +112,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -191,7 +191,7 @@ func newDelete() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/workspace/instance-profiles/instance-profiles.go b/cmd/workspace/instance-profiles/instance-profiles.go index 919ec511..7134c16c 100755 --- a/cmd/workspace/instance-profiles/instance-profiles.go +++ b/cmd/workspace/instance-profiles/instance-profiles.go @@ -83,13 +83,13 @@ func newAdd() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -176,13 +176,13 @@ func newEdit() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -295,13 +295,13 @@ func newRemove() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/ip-access-lists/ip-access-lists.go b/cmd/workspace/ip-access-lists/ip-access-lists.go index 2b6ddfa2..ec5958b5 100755 --- a/cmd/workspace/ip-access-lists/ip-access-lists.go +++ b/cmd/workspace/ip-access-lists/ip-access-lists.go @@ -117,13 +117,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -398,13 +398,13 @@ func newReplace() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index 8a98e1c8..17bef3aa 100755 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -106,7 +106,7 @@ func newCancelAllRuns() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -178,7 +178,7 @@ func newCancelRun() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1050,7 +1050,7 @@ func newListRuns() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1127,7 +1127,7 @@ func newRepairRun() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { 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.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1614,7 +1614,7 @@ func newUpdate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'job_id' in your JSON input") } diff --git a/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go b/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go index 9559d036..95a536a0 100755 --- a/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go +++ b/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go @@ -93,7 +93,7 @@ func newCancelRefresh() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -150,7 +150,7 @@ func newCreate() *cobra.Command { // 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.`) // TODO: array: slicing_exprs - // TODO: complex arg: snapshot + // TODO: output-only field // TODO: complex arg: time_series 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -267,7 +267,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -336,7 +336,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -404,7 +404,7 @@ func newGetRefresh() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -473,7 +473,7 @@ func newListRefreshes() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -541,7 +541,7 @@ func newRunRefresh() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -596,7 +596,7 @@ func newUpdate() *cobra.Command { // TODO: array: notifications // TODO: complex arg: schedule // TODO: array: slicing_exprs - // TODO: complex arg: snapshot + // TODO: output-only field // TODO: complex arg: time_series 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 { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/lakeview/lakeview.go b/cmd/workspace/lakeview/lakeview.go index a8148399..df42e719 100755 --- a/cmd/workspace/lakeview/lakeview.go +++ b/cmd/workspace/lakeview/lakeview.go @@ -70,7 +70,7 @@ func newPublish() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/libraries/libraries.go b/cmd/workspace/libraries/libraries.go index d6761a82..e11e5a4c 100755 --- a/cmd/workspace/libraries/libraries.go +++ b/cmd/workspace/libraries/libraries.go @@ -146,7 +146,7 @@ func newClusterStatus() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index 97e77a47..dd40bf92 100755 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -94,13 +94,13 @@ func newAssign() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -183,13 +183,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -525,7 +525,7 @@ func newUnassign() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/model-registry/model-registry.go b/cmd/workspace/model-registry/model-registry.go index 74e5e66e..41f06ac4 100755 --- a/cmd/workspace/model-registry/model-registry.go +++ b/cmd/workspace/model-registry/model-registry.go @@ -125,13 +125,13 @@ func newApproveTransitionRequest() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } @@ -219,13 +219,13 @@ func newCreateComment() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -306,13 +306,13 @@ func newCreateModel() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -387,13 +387,13 @@ func newCreateModelVersion() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'source' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -477,13 +477,13 @@ func newCreateTransitionRequest() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -622,7 +622,7 @@ func newDeleteComment() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -680,7 +680,7 @@ func newDeleteModel() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -740,7 +740,7 @@ func newDeleteModelTag() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -800,7 +800,7 @@ func newDeleteModelVersion() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -862,7 +862,7 @@ func newDeleteModelVersionTag() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -937,7 +937,7 @@ func newDeleteTransitionRequest() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } @@ -1002,7 +1002,7 @@ func newDeleteWebhook() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1063,13 +1063,13 @@ func newGetLatestVersions() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1136,7 +1136,7 @@ func newGetModel() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1195,7 +1195,7 @@ func newGetModelVersion() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -1255,7 +1255,7 @@ func newGetModelVersionDownloadUri() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -1314,7 +1314,7 @@ func newGetPermissionLevels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1373,7 +1373,7 @@ func newGetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1432,7 +1432,7 @@ func newListModels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1486,7 +1486,7 @@ func newListTransitionRequests() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -1545,7 +1545,7 @@ func newListWebhooks() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1613,13 +1613,13 @@ func newRejectTransitionRequest() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -1699,13 +1699,13 @@ func newRenameModel() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1773,7 +1773,7 @@ func newSearchModelVersions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1828,7 +1828,7 @@ func newSearchModels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -1891,13 +1891,13 @@ func newSetModelTag() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -1980,13 +1980,13 @@ func newSetModelVersionTag() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } @@ -2066,7 +2066,7 @@ func newSetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2150,13 +2150,13 @@ func newTestRegistryWebhook() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2243,13 +2243,13 @@ func newTransitionStage() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } @@ -2334,13 +2334,13 @@ func newUpdateComment() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id', 'comment' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -2414,13 +2414,13 @@ func newUpdateModel() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2492,13 +2492,13 @@ func newUpdateModelVersion() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'version' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -2572,7 +2572,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -2647,13 +2647,13 @@ func newUpdateWebhook() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'id' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/model-versions/model-versions.go b/cmd/workspace/model-versions/model-versions.go index b322e880..a606b01d 100755 --- a/cmd/workspace/model-versions/model-versions.go +++ b/cmd/workspace/model-versions/model-versions.go @@ -83,7 +83,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -151,7 +151,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -219,7 +219,7 @@ func newGetByAlias() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -293,7 +293,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -360,7 +360,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/online-tables/online-tables.go b/cmd/workspace/online-tables/online-tables.go index 2a5574da..a1e21e0f 100755 --- a/cmd/workspace/online-tables/online-tables.go +++ b/cmd/workspace/online-tables/online-tables.go @@ -69,7 +69,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -134,7 +134,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -192,7 +192,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/permission-migration/permission-migration.go b/cmd/workspace/permission-migration/permission-migration.go index a957d5ca..40d3f9a3 100755 --- a/cmd/workspace/permission-migration/permission-migration.go +++ b/cmd/workspace/permission-migration/permission-migration.go @@ -80,13 +80,13 @@ func newMigratePermissions() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/workspace/permissions/permissions.go b/cmd/workspace/permissions/permissions.go index 5bf837e3..38a3bf9c 100755 --- a/cmd/workspace/permissions/permissions.go +++ b/cmd/workspace/permissions/permissions.go @@ -118,7 +118,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -178,7 +178,7 @@ func newGetPermissionLevels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -246,7 +246,7 @@ func newSet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -320,7 +320,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index 78f42d6c..b7c3235f 100755 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -432,7 +432,7 @@ func newGetUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -562,7 +562,7 @@ func newListPipelines() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/policy-families/policy-families.go b/cmd/workspace/policy-families/policy-families.go index f6c07bf7..beee6e96 100755 --- a/cmd/workspace/policy-families/policy-families.go +++ b/cmd/workspace/policy-families/policy-families.go @@ -69,7 +69,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -127,7 +127,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/providers/providers.go b/cmd/workspace/providers/providers.go index 93f89c98..7305191c 100755 --- a/cmd/workspace/providers/providers.go +++ b/cmd/workspace/providers/providers.go @@ -81,13 +81,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -304,7 +304,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/queries/queries.go b/cmd/workspace/queries/queries.go index f2ab6f59..0126097f 100755 --- a/cmd/workspace/queries/queries.go +++ b/cmd/workspace/queries/queries.go @@ -284,7 +284,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/query-history/query-history.go b/cmd/workspace/query-history/query-history.go index a0402e6d..60d6004d 100755 --- a/cmd/workspace/query-history/query-history.go +++ b/cmd/workspace/query-history/query-history.go @@ -67,7 +67,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/query-visualizations/query-visualizations.go b/cmd/workspace/query-visualizations/query-visualizations.go index 4161ac7d..c94d83a8 100755 --- a/cmd/workspace/query-visualizations/query-visualizations.go +++ b/cmd/workspace/query-visualizations/query-visualizations.go @@ -128,7 +128,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -186,7 +186,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/recipient-activation/recipient-activation.go b/cmd/workspace/recipient-activation/recipient-activation.go index 068e6bb1..457fa904 100755 --- a/cmd/workspace/recipient-activation/recipient-activation.go +++ b/cmd/workspace/recipient-activation/recipient-activation.go @@ -73,7 +73,7 @@ func newGetActivationUrlInfo() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -132,7 +132,7 @@ func newRetrieveToken() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/recipients/recipients.go b/cmd/workspace/recipients/recipients.go index 79786313..c21d8a8c 100755 --- a/cmd/workspace/recipients/recipients.go +++ b/cmd/workspace/recipients/recipients.go @@ -101,13 +101,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -324,7 +324,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -385,13 +385,13 @@ func newRotateToken() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/registered-models/registered-models.go b/cmd/workspace/registered-models/registered-models.go index 6cd01c13..5d0d2673 100755 --- a/cmd/workspace/registered-models/registered-models.go +++ b/cmd/workspace/registered-models/registered-models.go @@ -119,13 +119,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } @@ -279,7 +279,7 @@ func newDeleteAlias() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -426,7 +426,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -489,13 +489,13 @@ func newSetAlias() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(2)(cmd, args) + err := root.ExactArgs(2)(cmd, args) 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 nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/workspace/repos/overrides.go b/cmd/workspace/repos/overrides.go index f6f26f81..96d645ef 100644 --- a/cmd/workspace/repos/overrides.go +++ b/cmd/workspace/repos/overrides.go @@ -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. check := cobra.RangeArgs(1, 2) if cmd.Flags().Changed("json") { - check = cobra.ExactArgs(0) + check = root.ExactArgs(0) } return check(cmd, args) } diff --git a/cmd/workspace/repos/repos.go b/cmd/workspace/repos/repos.go index 6a989437..fb3d51b0 100755 --- a/cmd/workspace/repos/repos.go +++ b/cmd/workspace/repos/repos.go @@ -94,13 +94,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'url', 'provider' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -457,7 +457,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go index d6b8a842..e0ca8030 100755 --- a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go +++ b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go @@ -78,7 +78,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -133,7 +133,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/schemas/schemas.go b/cmd/workspace/schemas/schemas.go index a5efeed3..6d9d26f5 100755 --- a/cmd/workspace/schemas/schemas.go +++ b/cmd/workspace/schemas/schemas.go @@ -84,13 +84,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) 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 nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -311,7 +311,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/secrets/put_secret.go b/cmd/workspace/secrets/put_secret.go index 2fbf49c5..e323c7a1 100644 --- a/cmd/workspace/secrets/put_secret.go +++ b/cmd/workspace/secrets/put_secret.go @@ -50,9 +50,9 @@ func newPutSecret() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) if cmd.Flags().Changed("json") { - check = cobra.ExactArgs(0) + check = root.ExactArgs(0) } return check(cmd, args) } diff --git a/cmd/workspace/secrets/secrets.go b/cmd/workspace/secrets/secrets.go index 35b84907..981062df 100755 --- a/cmd/workspace/secrets/secrets.go +++ b/cmd/workspace/secrets/secrets.go @@ -95,13 +95,13 @@ func newCreateScope() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'scope' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -176,13 +176,13 @@ func newDeleteAcl() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'scope', 'principal' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -258,13 +258,13 @@ func newDeleteScope() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'scope' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -339,13 +339,13 @@ func newDeleteSecret() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'scope', 'key' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -420,7 +420,7 @@ func newGetAcl() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -491,7 +491,7 @@ func newGetSecret() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -555,7 +555,7 @@ func newListAcls() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -659,7 +659,7 @@ func newListSecrets() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -744,13 +744,13 @@ func newPutAcl() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'scope', 'principal', 'permission' in your JSON input") } return nil } - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/workspace/service-principals/service-principals.go b/cmd/workspace/service-principals/service-principals.go index d363a1ba..957cb126 100755 --- a/cmd/workspace/service-principals/service-principals.go +++ b/cmd/workspace/service-principals/service-principals.go @@ -85,7 +85,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -294,7 +294,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/serving-endpoints/serving-endpoints.go b/cmd/workspace/serving-endpoints/serving-endpoints.go index c4ca7d62..45dff030 100755 --- a/cmd/workspace/serving-endpoints/serving-endpoints.go +++ b/cmd/workspace/serving-endpoints/serving-endpoints.go @@ -97,7 +97,7 @@ func newBuildLogs() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -232,7 +232,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -292,7 +292,7 @@ func newExportMetrics() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -350,7 +350,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -408,7 +408,7 @@ func newGetPermissionLevels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -467,7 +467,7 @@ func newGetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -566,7 +566,7 @@ func newLogs() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -632,7 +632,7 @@ func newPatch() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -702,7 +702,7 @@ func newPut() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -780,7 +780,7 @@ func newQuery() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -849,7 +849,7 @@ func newSetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -928,7 +928,7 @@ func newUpdateConfig() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -1010,7 +1010,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/settings/settings.go b/cmd/workspace/settings/settings.go index 38e19e83..8ba0335f 100755 --- a/cmd/workspace/settings/settings.go +++ b/cmd/workspace/settings/settings.go @@ -25,6 +25,9 @@ func New() *cobra.Command { Annotations: map[string]string{ "package": "settings", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // Add subservices diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index b849f84f..0e3523ce 100755 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -83,13 +83,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -156,7 +156,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -217,7 +217,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -317,7 +317,7 @@ func newSharePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -395,7 +395,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -467,7 +467,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/storage-credentials/storage-credentials.go b/cmd/workspace/storage-credentials/storage-credentials.go index b763d193..3164baa2 100755 --- a/cmd/workspace/storage-credentials/storage-credentials.go +++ b/cmd/workspace/storage-credentials/storage-credentials.go @@ -78,7 +78,7 @@ func newCreate() *cobra.Command { // TODO: complex arg: azure_service_principal // TODO: complex arg: cloudflare_api_token cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `Comment associated with the credential.`) - // TODO: complex arg: databricks_gcp_service_account + // TODO: output-only field cmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `Whether the storage credential is only usable for read operations.`) cmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Supplying true to this argument skips validation of the created credential.`) @@ -95,13 +95,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -317,7 +317,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -365,7 +365,7 @@ func newUpdate() *cobra.Command { // TODO: complex arg: azure_service_principal // TODO: complex arg: cloudflare_api_token cmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `Comment associated with the credential.`) - // TODO: complex arg: databricks_gcp_service_account + // TODO: output-only field cmd.Flags().BoolVar(&updateReq.Force, "force", updateReq.Force, `Force update even if there are dependent external locations or external tables.`) cmd.Flags().StringVar(&updateReq.NewName, "new-name", updateReq.NewName, `New name for the storage credential.`) cmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of credential.`) @@ -454,7 +454,7 @@ func newValidate() *cobra.Command { // TODO: complex arg: azure_managed_identity // TODO: complex arg: azure_service_principal // TODO: complex arg: cloudflare_api_token - // TODO: complex arg: databricks_gcp_service_account + // TODO: output-only field cmd.Flags().StringVar(&validateReq.ExternalLocationName, "external-location-name", validateReq.ExternalLocationName, `The name of an existing external location to validate.`) cmd.Flags().BoolVar(&validateReq.ReadOnly, "read-only", validateReq.ReadOnly, `Whether the storage credential is only usable for read operations.`) cmd.Flags().StringVar(&validateReq.StorageCredentialName, "storage-credential-name", validateReq.StorageCredentialName, `The name of the storage credential to validate.`) @@ -480,7 +480,7 @@ func newValidate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/system-schemas/system-schemas.go b/cmd/workspace/system-schemas/system-schemas.go index d8135ac2..070701d2 100755 --- a/cmd/workspace/system-schemas/system-schemas.go +++ b/cmd/workspace/system-schemas/system-schemas.go @@ -71,7 +71,7 @@ func newDisable() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -135,7 +135,7 @@ func newEnable() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -198,7 +198,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/table-constraints/table-constraints.go b/cmd/workspace/table-constraints/table-constraints.go index d5597ab3..166da146 100755 --- a/cmd/workspace/table-constraints/table-constraints.go +++ b/cmd/workspace/table-constraints/table-constraints.go @@ -159,7 +159,7 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(3) + check := root.ExactArgs(3) return check(cmd, args) } diff --git a/cmd/workspace/tables/tables.go b/cmd/workspace/tables/tables.go index 1ee6b0d5..793fb7a2 100755 --- a/cmd/workspace/tables/tables.go +++ b/cmd/workspace/tables/tables.go @@ -320,7 +320,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/token-management/token-management.go b/cmd/workspace/token-management/token-management.go index 5209ff16..dea94edb 100755 --- a/cmd/workspace/token-management/token-management.go +++ b/cmd/workspace/token-management/token-management.go @@ -81,7 +81,7 @@ func newCreateOboToken() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'application_id' in your JSON input") } @@ -393,7 +393,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -448,7 +448,7 @@ func newSetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -513,7 +513,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/tokens/tokens.go b/cmd/workspace/tokens/tokens.go index bdb99d60..afe4b9a0 100755 --- a/cmd/workspace/tokens/tokens.go +++ b/cmd/workspace/tokens/tokens.go @@ -74,7 +74,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -143,7 +143,7 @@ func newDelete() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'token_id' in your JSON input") } diff --git a/cmd/workspace/users/users.go b/cmd/workspace/users/users.go index 676b10a0..53ba2e85 100755 --- a/cmd/workspace/users/users.go +++ b/cmd/workspace/users/users.go @@ -97,7 +97,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -399,7 +399,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -536,7 +536,7 @@ func newSetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -692,7 +692,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go index a8d3d3ee..dd9d5783 100755 --- a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go +++ b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go @@ -79,13 +79,13 @@ func newCreateEndpoint() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'endpoint_type' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -174,7 +174,7 @@ func newDeleteEndpoint() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -230,7 +230,7 @@ func newGetEndpoint() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -285,7 +285,7 @@ func newListEndpoints() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/vector-search-indexes/vector-search-indexes.go b/cmd/workspace/vector-search-indexes/vector-search-indexes.go index a9b9f51d..4e117e5b 100755 --- a/cmd/workspace/vector-search-indexes/vector-search-indexes.go +++ b/cmd/workspace/vector-search-indexes/vector-search-indexes.go @@ -96,13 +96,13 @@ func newCreateIndex() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'endpoint_name', 'primary_key', 'index_type' in your JSON input") } return nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } @@ -183,7 +183,7 @@ func newDeleteDataVectorIndex() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -249,7 +249,7 @@ func newDeleteIndex() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -307,7 +307,7 @@ func newGetIndex() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -367,7 +367,7 @@ func newListIndexes() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -429,7 +429,7 @@ func newQueryIndex() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -495,7 +495,7 @@ func newSyncIndex() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -558,13 +558,13 @@ func newUpsertDataVectorIndex() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(1)(cmd, args) + err := root.ExactArgs(1)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, provide only INDEX_NAME as positional arguments. Provide 'inputs_json' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/volumes/volumes.go b/cmd/workspace/volumes/volumes.go index 5a2991b9..335b7d01 100755 --- a/cmd/workspace/volumes/volumes.go +++ b/cmd/workspace/volumes/volumes.go @@ -103,13 +103,13 @@ func newCreate() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'catalog_name', 'schema_name', 'name', 'volume_type' in your JSON input") } return nil } - check := cobra.ExactArgs(4) + check := root.ExactArgs(4) return check(cmd, args) } @@ -275,7 +275,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/warehouses/warehouses.go b/cmd/workspace/warehouses/warehouses.go index 3d1f0543..cdf10636 100755 --- a/cmd/workspace/warehouses/warehouses.go +++ b/cmd/workspace/warehouses/warehouses.go @@ -99,7 +99,7 @@ func newCreate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -625,7 +625,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } @@ -769,7 +769,7 @@ func newSetWorkspaceWarehouseConfig() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) + check := root.ExactArgs(0) return check(cmd, args) } diff --git a/cmd/workspace/workspace-bindings/workspace-bindings.go b/cmd/workspace/workspace-bindings/workspace-bindings.go index 3543f1e9..b7e0614e 100755 --- a/cmd/workspace/workspace-bindings/workspace-bindings.go +++ b/cmd/workspace/workspace-bindings/workspace-bindings.go @@ -85,7 +85,7 @@ func newGet() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -145,7 +145,7 @@ func newGetBindings() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -210,7 +210,7 @@ func newUpdate() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -281,7 +281,7 @@ func newUpdateBindings() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/cmd/workspace/workspace-conf/workspace-conf.go b/cmd/workspace/workspace-conf/workspace-conf.go index 87ea86c8..92b2f0f3 100755 --- a/cmd/workspace/workspace-conf/workspace-conf.go +++ b/cmd/workspace/workspace-conf/workspace-conf.go @@ -64,7 +64,7 @@ func newGetStatus() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } diff --git a/cmd/workspace/workspace/export_dir.go b/cmd/workspace/workspace/export_dir.go index 79e64e8a..0b53666f 100644 --- a/cmd/workspace/workspace/export_dir.go +++ b/cmd/workspace/workspace/export_dir.go @@ -94,7 +94,7 @@ func newExportDir() *cobra.Command { ` cmd.Annotations = make(map[string]string) - cmd.Args = cobra.ExactArgs(2) + cmd.Args = root.ExactArgs(2) cmd.PreRunE = root.MustWorkspaceClient cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/workspace/workspace/import_dir.go b/cmd/workspace/workspace/import_dir.go index 6ce5f3c2..19d9a0a1 100644 --- a/cmd/workspace/workspace/import_dir.go +++ b/cmd/workspace/workspace/import_dir.go @@ -119,7 +119,7 @@ Notebooks will have their extensions (one of .scala, .py, .sql, .ipynb, .r) stri ` cmd.Annotations = make(map[string]string) - cmd.Args = cobra.ExactArgs(2) + cmd.Args = root.ExactArgs(2) cmd.PreRunE = root.MustWorkspaceClient cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/workspace/workspace/workspace.go b/cmd/workspace/workspace/workspace.go index 42517c43..183cac89 100755 --- a/cmd/workspace/workspace/workspace.go +++ b/cmd/workspace/workspace/workspace.go @@ -91,7 +91,7 @@ func newDelete() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'path' in your JSON input") } @@ -266,7 +266,7 @@ func newGetPermissionLevels() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -327,7 +327,7 @@ func newGetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -387,7 +387,7 @@ func newGetStatus() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -466,13 +466,13 @@ func newImport() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'path' in your JSON input") } return nil } - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -542,7 +542,7 @@ func newList() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(1) + check := root.ExactArgs(1) return check(cmd, args) } @@ -607,7 +607,7 @@ func newMkdirs() *cobra.Command { cmd.Args = func(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("json") { - err := cobra.ExactArgs(0)(cmd, args) + err := root.ExactArgs(0)(cmd, args) if err != nil { return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'path' in your JSON input") } @@ -700,7 +700,7 @@ func newSetPermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } @@ -771,7 +771,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := root.ExactArgs(2) return check(cmd, args) } diff --git a/internal/clusters_test.go b/internal/clusters_test.go index e8208d04..6daddcce 100644 --- a/internal/clusters_test.go +++ b/internal/clusters_test.go @@ -36,5 +36,5 @@ func TestAccClustersGet(t *testing.T) { func TestClusterCreateErrorWhenNoArguments(t *testing.T) { _, _, err := RequireErrorRun(t, "clusters", "create") - assert.Equal(t, "accepts 1 arg(s), received 0", err.Error()) + assert.Contains(t, err.Error(), "accepts 1 arg(s), received 0") } diff --git a/internal/secrets_test.go b/internal/secrets_test.go index b030071b..d9c03f09 100644 --- a/internal/secrets_test.go +++ b/internal/secrets_test.go @@ -14,7 +14,7 @@ import ( func TestSecretsCreateScopeErrWhenNoArguments(t *testing.T) { _, _, err := RequireErrorRun(t, "secrets", "create-scope") - assert.Equal(t, "accepts 1 arg(s), received 0", err.Error()) + assert.Contains(t, err.Error(), "accepts 1 arg(s), received 0") } func temporarySecretScope(ctx context.Context, t *acc.WorkspaceT) string { diff --git a/internal/workspace_test.go b/internal/workspace_test.go index 16467739..6ca8cd4f 100644 --- a/internal/workspace_test.go +++ b/internal/workspace_test.go @@ -34,12 +34,12 @@ func TestAccWorkspaceList(t *testing.T) { func TestWorkpaceListErrorWhenNoArguments(t *testing.T) { _, _, err := RequireErrorRun(t, "workspace", "list") - assert.Equal(t, "accepts 1 arg(s), received 0", err.Error()) + assert.Contains(t, err.Error(), "accepts 1 arg(s), received 0") } func TestWorkpaceGetStatusErrorWhenNoArguments(t *testing.T) { _, _, err := RequireErrorRun(t, "workspace", "get-status") - assert.Equal(t, "accepts 1 arg(s), received 0", err.Error()) + assert.Contains(t, err.Error(), "accepts 1 arg(s), received 0") } func TestWorkpaceExportPrintsContents(t *testing.T) {