diff --git a/acceptance/cmd/workspace/apps/output.txt b/acceptance/cmd/workspace/apps/output.txt index 5b22a4c83a1..52f2937f009 100644 --- a/acceptance/cmd/workspace/apps/output.txt +++ b/acceptance/cmd/workspace/apps/output.txt @@ -89,14 +89,16 @@ Usage: databricks apps update NAME [flags] Flags: - --budget-policy-id string - --compute-max-instances int Maximum number of app instances. - --compute-min-instances int Minimum number of app instances. - --compute-size ComputeSize Supported values: [LARGE, MEDIUM, XLARGE] - --description string The description of the app. - -h, --help help for update - --json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes)) - --space string Name of the space this app belongs to. + --budget-policy-id string + --compute-max-instances int Maximum number of app instances. + --compute-min-instances int Minimum number of app instances. + --compute-size ComputeSize Supported values: [LARGE, MEDIUM, XLARGE] + --description string The description of the app. + --generate-skeleton-full Print a fillable JSON skeleton of the full --json request body and exit. + --generate-skeleton-required-only Print a fillable JSON skeleton of only the required --json fields and exit. + -h, --help help for update + --json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes)) + --space string Name of the space this app belongs to. --usage-policy-id string Global Flags: diff --git a/acceptance/cmd/workspace/database/update-database-instance/output.txt b/acceptance/cmd/workspace/database/update-database-instance/output.txt index 463b128eaf4..5f95294a7d6 100644 --- a/acceptance/cmd/workspace/database/update-database-instance/output.txt +++ b/acceptance/cmd/workspace/database/update-database-instance/output.txt @@ -6,15 +6,17 @@ Usage: databricks database update-database-instance NAME UPDATE_MASK [flags] Flags: - --capacity string The sku of the instance. - --enable-pg-native-login Whether to enable PG native password login on the instance. - --enable-readable-secondaries Whether to enable secondaries to serve read-only traffic. - -h, --help help for update-database-instance - --json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes)) - --node-count int The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. - --retention-window-in-days int The retention window for the instance. - --stopped Whether to stop the instance. - --usage-policy-id string The desired usage policy to associate with the instance. + --capacity string The sku of the instance. + --enable-pg-native-login Whether to enable PG native password login on the instance. + --enable-readable-secondaries Whether to enable secondaries to serve read-only traffic. + --generate-skeleton-full Print a fillable JSON skeleton of the full --json request body and exit. + --generate-skeleton-required-only Print a fillable JSON skeleton of only the required --json fields and exit. + -h, --help help for update-database-instance + --json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes)) + --node-count int The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. + --retention-window-in-days int The retention window for the instance. + --stopped Whether to stop the instance. + --usage-policy-id string The desired usage policy to associate with the instance. Global Flags: --debug enable debug logging diff --git a/acceptance/cmd/workspace/generate-skeleton/out.test.toml b/acceptance/cmd/workspace/generate-skeleton/out.test.toml new file mode 100644 index 00000000000..d6187dcb046 --- /dev/null +++ b/acceptance/cmd/workspace/generate-skeleton/out.test.toml @@ -0,0 +1,3 @@ +Local = true +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = [] diff --git a/acceptance/cmd/workspace/generate-skeleton/output.txt b/acceptance/cmd/workspace/generate-skeleton/output.txt new file mode 100644 index 00000000000..943419fcb9a --- /dev/null +++ b/acceptance/cmd/workspace/generate-skeleton/output.txt @@ -0,0 +1,47 @@ + +=== Plain --json request body: full skeleton is the whole request struct + +>>> [CLI] vector-search-endpoints create-endpoint --generate-skeleton-full +{ + "budget_policy_id": "", + "endpoint_type": "", + "name": "", + "target_qps": 0, + "usage_policy_id": "" +} + +=== Plain --json request body: required-only keeps just the mandatory fields + +>>> [CLI] vector-search-endpoints create-endpoint --generate-skeleton-required-only +{ + "endpoint_type": "", + "name": "" +} + +=== Request-body-field command: full skeleton, positional args relaxed + +>>> [CLI] entity-tag-assignments create --generate-skeleton-full +{ + "entity_name": "", + "entity_type": "", + "source_type": "", + "tag_key": "", + "tag_value": "", + "update_time": "", + "updated_by": "" +} + +=== Request-body-field command: required-only recurses into the body field + +>>> [CLI] entity-tag-assignments create --generate-skeleton-required-only +{ + "entity_name": "", + "entity_type": "", + "tag_key": "" +} + +=== The two skeleton flags are mutually exclusive +Error: if any flags in the group [generate-skeleton-full generate-skeleton-required-only] are set none of the others can be; [generate-skeleton-full generate-skeleton-required-only] were all set + +=== A skeleton flag is incompatible with --json +Error: --generate-skeleton-full cannot be combined with --json diff --git a/acceptance/cmd/workspace/generate-skeleton/script b/acceptance/cmd/workspace/generate-skeleton/script new file mode 100644 index 00000000000..c1caae4232f --- /dev/null +++ b/acceptance/cmd/workspace/generate-skeleton/script @@ -0,0 +1,17 @@ +title "Plain --json request body: full skeleton is the whole request struct\n" +trace $CLI vector-search-endpoints create-endpoint --generate-skeleton-full + +title "Plain --json request body: required-only keeps just the mandatory fields\n" +trace $CLI vector-search-endpoints create-endpoint --generate-skeleton-required-only + +title "Request-body-field command: full skeleton, positional args relaxed\n" +trace $CLI entity-tag-assignments create --generate-skeleton-full + +title "Request-body-field command: required-only recurses into the body field\n" +trace $CLI entity-tag-assignments create --generate-skeleton-required-only + +title "The two skeleton flags are mutually exclusive\n" +musterr $CLI vector-search-endpoints create-endpoint --generate-skeleton-full --generate-skeleton-required-only + +title "A skeleton flag is incompatible with --json\n" +musterr $CLI jobs create --generate-skeleton-full --json '{}' diff --git a/acceptance/cmd/workspace/generate-skeleton/test.toml b/acceptance/cmd/workspace/generate-skeleton/test.toml new file mode 100644 index 00000000000..eb64f769687 --- /dev/null +++ b/acceptance/cmd/workspace/generate-skeleton/test.toml @@ -0,0 +1,3 @@ +# --generate-skeleton is offline and not bundle-aware; run it once instead of per-engine. +[EnvMatrix] +DATABRICKS_BUNDLE_ENGINE = [] diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index 3be9b6579cb..7608a0576ba 100644 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -273,6 +273,10 @@ Update a rule set. fn(cmd, &updateRuleSetReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateRuleSetReq) + return cmd } diff --git a/cmd/account/budget-policy/budget-policy.go b/cmd/account/budget-policy/budget-policy.go index 917f23548dc..c879ac79b7f 100644 --- a/cmd/account/budget-policy/budget-policy.go +++ b/cmd/account/budget-policy/budget-policy.go @@ -119,6 +119,10 @@ Create a budget policy. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -398,6 +402,10 @@ Update a budget policy. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.Policy) + return cmd } diff --git a/cmd/account/budgets/budgets.go b/cmd/account/budgets/budgets.go index 723486a2e40..b0001939b1d 100644 --- a/cmd/account/budgets/budgets.go +++ b/cmd/account/budgets/budgets.go @@ -118,6 +118,10 @@ Create new budget. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -390,6 +394,10 @@ Modify budget. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/credentials/credentials.go b/cmd/account/credentials/credentials.go index 580a650e889..05846c40325 100644 --- a/cmd/account/credentials/credentials.go +++ b/cmd/account/credentials/credentials.go @@ -125,6 +125,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/csp-enablement-account/csp-enablement-account.go b/cmd/account/csp-enablement-account/csp-enablement-account.go index 6e90bdae435..d64f4b2f540 100644 --- a/cmd/account/csp-enablement-account/csp-enablement-account.go +++ b/cmd/account/csp-enablement-account/csp-enablement-account.go @@ -174,6 +174,10 @@ Update the compliance security profile setting for new workspaces. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/custom-app-integration/custom-app-integration.go b/cmd/account/custom-app-integration/custom-app-integration.go index 16882132e51..213482693d6 100644 --- a/cmd/account/custom-app-integration/custom-app-integration.go +++ b/cmd/account/custom-app-integration/custom-app-integration.go @@ -126,6 +126,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -393,6 +397,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/disable-legacy-features/disable-legacy-features.go b/cmd/account/disable-legacy-features/disable-legacy-features.go index 7ded95ff0a3..7de5f34ef71 100644 --- a/cmd/account/disable-legacy-features/disable-legacy-features.go +++ b/cmd/account/disable-legacy-features/disable-legacy-features.go @@ -222,6 +222,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/disaster-recovery/disaster-recovery.go b/cmd/account/disaster-recovery/disaster-recovery.go index f593144adb8..2d2bf57f743 100644 --- a/cmd/account/disaster-recovery/disaster-recovery.go +++ b/cmd/account/disaster-recovery/disaster-recovery.go @@ -164,6 +164,10 @@ Create a Failover Group. fn(cmd, &createFailoverGroupReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createFailoverGroupReq.FailoverGroup) + return cmd } @@ -260,6 +264,10 @@ Create a Stable URL. fn(cmd, &createStableUrlReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createStableUrlReq.StableUrl) + return cmd } @@ -485,6 +493,10 @@ Failover a Failover Group to a new primary region. fn(cmd, &failoverFailoverGroupReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &failoverFailoverGroupReq) + return cmd } @@ -881,6 +893,10 @@ Update a Failover Group. fn(cmd, &updateFailoverGroupReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateFailoverGroupReq.FailoverGroup) + return cmd } diff --git a/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go b/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go index e417dc92144..ad41acc6854 100644 --- a/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go +++ b/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go @@ -222,6 +222,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/encryption-keys/encryption-keys.go b/cmd/account/encryption-keys/encryption-keys.go index 941fe953d43..fe9469eb555 100644 --- a/cmd/account/encryption-keys/encryption-keys.go +++ b/cmd/account/encryption-keys/encryption-keys.go @@ -153,6 +153,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/endpoints/endpoints.go b/cmd/account/endpoints/endpoints.go index dff9c2344bf..0c28cf830ce 100644 --- a/cmd/account/endpoints/endpoints.go +++ b/cmd/account/endpoints/endpoints.go @@ -145,6 +145,10 @@ func newCreateEndpoint() *cobra.Command { fn(cmd, &createEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createEndpointReq.Endpoint) + return cmd } diff --git a/cmd/account/esm-enablement-account/esm-enablement-account.go b/cmd/account/esm-enablement-account/esm-enablement-account.go index 75af94183a2..8ec9cf331e8 100644 --- a/cmd/account/esm-enablement-account/esm-enablement-account.go +++ b/cmd/account/esm-enablement-account/esm-enablement-account.go @@ -172,6 +172,10 @@ Update the enhanced security monitoring setting for new workspaces. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/federation-policy/federation-policy.go b/cmd/account/federation-policy/federation-policy.go index f9ccb47c442..8f60d0f3540 100644 --- a/cmd/account/federation-policy/federation-policy.go +++ b/cmd/account/federation-policy/federation-policy.go @@ -163,6 +163,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.Policy) + return cmd } @@ -421,6 +425,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.Policy) + return cmd } diff --git a/cmd/account/groups-v2/groups-v2.go b/cmd/account/groups-v2/groups-v2.go index 63c47c53ee8..959101660ed 100644 --- a/cmd/account/groups-v2/groups-v2.go +++ b/cmd/account/groups-v2/groups-v2.go @@ -127,6 +127,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -400,6 +404,10 @@ func newPatch() *cobra.Command { fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -479,6 +487,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/iam-v2/iam-v2.go b/cmd/account/iam-v2/iam-v2.go index 7de37b8ca7b..a7e3e361821 100644 --- a/cmd/account/iam-v2/iam-v2.go +++ b/cmd/account/iam-v2/iam-v2.go @@ -156,6 +156,10 @@ func newCreateWorkspaceAssignmentDetail() *cobra.Command { fn(cmd, &createWorkspaceAssignmentDetailReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createWorkspaceAssignmentDetailReq.WorkspaceAssignmentDetail) + return cmd } @@ -543,6 +547,10 @@ Resolve an external group in the Databricks account. fn(cmd, &resolveGroupReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resolveGroupReq) + return cmd } @@ -630,6 +638,10 @@ Resolve an external service principal in the Databricks account. fn(cmd, &resolveServicePrincipalReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resolveServicePrincipalReq) + return cmd } @@ -717,6 +729,10 @@ Resolve an external user in the Databricks account. fn(cmd, &resolveUserReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resolveUserReq) + return cmd } @@ -832,6 +848,10 @@ func newUpdateWorkspaceAssignmentDetail() *cobra.Command { fn(cmd, &updateWorkspaceAssignmentDetailReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateWorkspaceAssignmentDetailReq.WorkspaceAssignmentDetail) + return cmd } diff --git a/cmd/account/ip-access-lists/ip-access-lists.go b/cmd/account/ip-access-lists/ip-access-lists.go index 7e9dab8b09b..eed8c07cac9 100644 --- a/cmd/account/ip-access-lists/ip-access-lists.go +++ b/cmd/account/ip-access-lists/ip-access-lists.go @@ -172,6 +172,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -482,6 +486,10 @@ func newReplace() *cobra.Command { fn(cmd, &replaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &replaceReq) + return cmd } @@ -585,6 +593,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go b/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go index c81d65af84c..94c64283d3e 100644 --- a/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go +++ b/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go @@ -164,6 +164,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go b/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go index 035b0a0accf..a50a7e8306c 100644 --- a/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go +++ b/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go @@ -166,6 +166,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/log-delivery/log-delivery.go b/cmd/account/log-delivery/log-delivery.go index 93310e7aad5..99a9930b3b7 100644 --- a/cmd/account/log-delivery/log-delivery.go +++ b/cmd/account/log-delivery/log-delivery.go @@ -198,6 +198,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -440,6 +444,10 @@ func newPatchStatus() *cobra.Command { fn(cmd, &patchStatusReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchStatusReq) + return cmd } diff --git a/cmd/account/metastore-assignments/metastore-assignments.go b/cmd/account/metastore-assignments/metastore-assignments.go index 622b56f75dd..4ed0e7aa391 100644 --- a/cmd/account/metastore-assignments/metastore-assignments.go +++ b/cmd/account/metastore-assignments/metastore-assignments.go @@ -124,6 +124,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -410,6 +414,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/metastores/metastores.go b/cmd/account/metastores/metastores.go index 7967101987f..9a8e7cd9c7c 100644 --- a/cmd/account/metastores/metastores.go +++ b/cmd/account/metastores/metastores.go @@ -115,6 +115,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -368,6 +372,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/network-connectivity/network-connectivity.go b/cmd/account/network-connectivity/network-connectivity.go index 3a1b00e18f6..ab66ffab2d5 100644 --- a/cmd/account/network-connectivity/network-connectivity.go +++ b/cmd/account/network-connectivity/network-connectivity.go @@ -159,6 +159,10 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command { fn(cmd, &createNetworkConnectivityConfigurationReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createNetworkConnectivityConfigurationReq.NetworkConnectivityConfig) + return cmd } @@ -251,6 +255,10 @@ func newCreatePrivateEndpointRule() *cobra.Command { fn(cmd, &createPrivateEndpointRuleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createPrivateEndpointRuleReq.PrivateEndpointRule) + return cmd } @@ -728,6 +736,10 @@ func newUpdatePrivateEndpointRule() *cobra.Command { fn(cmd, &updatePrivateEndpointRuleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePrivateEndpointRuleReq.PrivateEndpointRule) + return cmd } diff --git a/cmd/account/network-policies/network-policies.go b/cmd/account/network-policies/network-policies.go index 15cc31d5fa0..7bab78cee64 100644 --- a/cmd/account/network-policies/network-policies.go +++ b/cmd/account/network-policies/network-policies.go @@ -125,6 +125,10 @@ func newCreateNetworkPolicyRpc() *cobra.Command { fn(cmd, &createNetworkPolicyRpcReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createNetworkPolicyRpcReq.NetworkPolicy) + return cmd } @@ -391,6 +395,10 @@ func newUpdateNetworkPolicyRpc() *cobra.Command { fn(cmd, &updateNetworkPolicyRpcReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateNetworkPolicyRpcReq.NetworkPolicy) + return cmd } diff --git a/cmd/account/networks/networks.go b/cmd/account/networks/networks.go index ae7318e76b9..e2f2ade9ee3 100644 --- a/cmd/account/networks/networks.go +++ b/cmd/account/networks/networks.go @@ -119,6 +119,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/personal-compute/personal-compute.go b/cmd/account/personal-compute/personal-compute.go index 1e6c3569975..5abddb79ecd 100644 --- a/cmd/account/personal-compute/personal-compute.go +++ b/cmd/account/personal-compute/personal-compute.go @@ -229,6 +229,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/private-access/private-access.go b/cmd/account/private-access/private-access.go index 779cad0cff7..6efd19f71ca 100644 --- a/cmd/account/private-access/private-access.go +++ b/cmd/account/private-access/private-access.go @@ -119,6 +119,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -370,6 +374,10 @@ func newReplace() *cobra.Command { fn(cmd, &replaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &replaceReq.CustomerFacingPrivateAccessSettings) + return cmd } diff --git a/cmd/account/published-app-integration/published-app-integration.go b/cmd/account/published-app-integration/published-app-integration.go index d49f9013eac..d0b50493188 100644 --- a/cmd/account/published-app-integration/published-app-integration.go +++ b/cmd/account/published-app-integration/published-app-integration.go @@ -122,6 +122,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -382,6 +386,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go b/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go index 7a148865891..2928cf4fc77 100644 --- a/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go +++ b/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go @@ -177,6 +177,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.Policy) + return cmd } @@ -469,6 +473,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.Policy) + return cmd } diff --git a/cmd/account/service-principal-secrets/service-principal-secrets.go b/cmd/account/service-principal-secrets/service-principal-secrets.go index 0ed1a3995f2..12336291c1c 100644 --- a/cmd/account/service-principal-secrets/service-principal-secrets.go +++ b/cmd/account/service-principal-secrets/service-principal-secrets.go @@ -128,6 +128,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/service-principals-v2/service-principals-v2.go b/cmd/account/service-principals-v2/service-principals-v2.go index ba6aadb6cb6..42f4d3a48ac 100644 --- a/cmd/account/service-principals-v2/service-principals-v2.go +++ b/cmd/account/service-principals-v2/service-principals-v2.go @@ -125,6 +125,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -396,6 +400,10 @@ func newPatch() *cobra.Command { fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -477,6 +485,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/settings-v2/settings-v2.go b/cmd/account/settings-v2/settings-v2.go index 91d655c2ef1..eca33b48276 100644 --- a/cmd/account/settings-v2/settings-v2.go +++ b/cmd/account/settings-v2/settings-v2.go @@ -430,6 +430,10 @@ Update an account setting. fn(cmd, &patchPublicAccountSettingReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchPublicAccountSettingReq.Setting) + return cmd } @@ -521,6 +525,10 @@ Update a user preference. fn(cmd, &patchPublicAccountUserPreferenceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchPublicAccountUserPreferenceReq.Setting) + return cmd } diff --git a/cmd/account/storage-credentials/storage-credentials.go b/cmd/account/storage-credentials/storage-credentials.go index ba3f3ded1b6..fcdafcc1758 100644 --- a/cmd/account/storage-credentials/storage-credentials.go +++ b/cmd/account/storage-credentials/storage-credentials.go @@ -124,6 +124,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -404,6 +408,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/storage/storage.go b/cmd/account/storage/storage.go index 116b58fc2ca..73886e7ac7b 100644 --- a/cmd/account/storage/storage.go +++ b/cmd/account/storage/storage.go @@ -115,6 +115,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/usage-dashboards/usage-dashboards.go b/cmd/account/usage-dashboards/usage-dashboards.go index cb19cbce56a..71a45b08b60 100644 --- a/cmd/account/usage-dashboards/usage-dashboards.go +++ b/cmd/account/usage-dashboards/usage-dashboards.go @@ -118,6 +118,10 @@ Create new usage dashboard. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/users-v2/users-v2.go b/cmd/account/users-v2/users-v2.go index baaec49dfc6..60cdc1d0dab 100644 --- a/cmd/account/users-v2/users-v2.go +++ b/cmd/account/users-v2/users-v2.go @@ -133,6 +133,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -412,6 +416,10 @@ func newPatch() *cobra.Command { fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -493,6 +501,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/vpc-endpoints/vpc-endpoints.go b/cmd/account/vpc-endpoints/vpc-endpoints.go index d05ae2fc063..6db75787977 100644 --- a/cmd/account/vpc-endpoints/vpc-endpoints.go +++ b/cmd/account/vpc-endpoints/vpc-endpoints.go @@ -126,6 +126,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/account/workspace-assignment/workspace-assignment.go b/cmd/account/workspace-assignment/workspace-assignment.go index 08895b11b96..bc287c68620 100644 --- a/cmd/account/workspace-assignment/workspace-assignment.go +++ b/cmd/account/workspace-assignment/workspace-assignment.go @@ -333,6 +333,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/account/workspace-network-configuration/workspace-network-configuration.go b/cmd/account/workspace-network-configuration/workspace-network-configuration.go index 58ef41e0119..ba031c30fa0 100644 --- a/cmd/account/workspace-network-configuration/workspace-network-configuration.go +++ b/cmd/account/workspace-network-configuration/workspace-network-configuration.go @@ -192,6 +192,10 @@ func newUpdateWorkspaceNetworkOptionRpc() *cobra.Command { fn(cmd, &updateWorkspaceNetworkOptionRpcReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption) + return cmd } diff --git a/cmd/account/workspaces/workspaces.go b/cmd/account/workspaces/workspaces.go index 1025f94e68b..4955f719bdd 100644 --- a/cmd/account/workspaces/workspaces.go +++ b/cmd/account/workspaces/workspaces.go @@ -198,6 +198,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -492,6 +496,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.CustomerFacingWorkspace) + return cmd } diff --git a/cmd/root/skeleton.go b/cmd/root/skeleton.go new file mode 100644 index 00000000000..f07f3190f2d --- /dev/null +++ b/cmd/root/skeleton.go @@ -0,0 +1,182 @@ +package root + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "slices" + "strings" + "time" + + "github.com/databricks/databricks-sdk-go/common/types/duration" + "github.com/databricks/databricks-sdk-go/common/types/fieldmask" + sdktime "github.com/databricks/databricks-sdk-go/common/types/time" + "github.com/spf13/cobra" +) + +// stringScalarTypes are struct types the SDK marshals to a single JSON string +// rather than an object: stdlib time.Time (RFC 3339) and the protobuf-backed +// well-known types the CLI codegen also treats as string-valued flags (see the +// IsTimestamp/IsDuration/IsFieldMask handling in internal/cligen). Reflecting +// into their unexported fields would otherwise render them as {}, so the +// skeleton emits an empty string placeholder instead. NB: every SDK request and +// message struct implements json.Marshaler too, so we cannot key off that +// interface — only these specific types marshal to a scalar. +var stringScalarTypes = map[reflect.Type]bool{ + reflect.TypeFor[time.Time](): true, + reflect.TypeFor[sdktime.Time](): true, + reflect.TypeFor[duration.Duration](): true, + reflect.TypeFor[fieldmask.FieldMask](): true, +} + +const ( + flagSkeletonFull = "generate-skeleton-full" + flagSkeletonRequiredOnly = "generate-skeleton-required-only" +) + +// RegisterGenerateSkeleton adds the --generate-skeleton-full and +// --generate-skeleton-required-only flags to cmd. Either prints a fillable JSON +// template of the command's --json request body (req must be a pointer to that +// request struct) and exits without contacting the workspace, so it works +// offline. --generate-skeleton-required-only keeps only the fields the API +// requires (struct fields whose json tag lacks ",omitempty"); --full keeps every +// field. Keys are sorted by name in both, so the two skeletons differ only in +// which fields are present. +// +// Call it from a command override: those run after the generated command has set +// PreRunE/RunE, so this wraps both to skip the workspace-client requirement and +// the API call on the skeleton path. +func RegisterGenerateSkeleton(cmd *cobra.Command, req any) { + var full, requiredOnly bool + cmd.Flags().BoolVar(&full, flagSkeletonFull, false, + `Print a fillable JSON skeleton of the full --json request body and exit.`) + cmd.Flags().BoolVar(&requiredOnly, flagSkeletonRequiredOnly, false, + `Print a fillable JSON skeleton of only the required --json fields and exit.`) + // The two skeletons are alternatives; asking for both is a user error. + cmd.MarkFlagsMutuallyExclusive(flagSkeletonFull, flagSkeletonRequiredOnly) + + // Cobra validates positional args before PreRunE/RunE, so commands that take + // required positionals (e.g. create-endpoint NAME ENDPOINT_TYPE) would reject + // a skeleton flag with no args before we can short-circuit. Relax it on the + // skeleton path. cmd.Args is nil for commands whose body is --json-only. + validateArgs := cmd.Args + cmd.Args = func(cmd *cobra.Command, args []string) error { + if full || requiredOnly { + return cobra.NoArgs(cmd, args) + } + if validateArgs == nil { + return nil + } + return validateArgs(cmd, args) + } + + mustWorkspaceClient := cmd.PreRunE + cmd.PreRunE = func(cmd *cobra.Command, args []string) error { + if full || requiredOnly { + return nil + } + return mustWorkspaceClient(cmd, args) + } + + apiCall := cmd.RunE + cmd.RunE = func(cmd *cobra.Command, args []string) error { + if !full && !requiredOnly { + return apiCall(cmd, args) + } + if cmd.Flags().Changed("json") { + return errors.New("--" + skeletonFlagName(full) + " cannot be combined with --json") + } + skeleton := jsonSkeleton(reflect.TypeOf(req).Elem(), requiredOnly, map[reflect.Type]bool{}) + out, err := json.MarshalIndent(skeleton, "", " ") + if err != nil { + return err + } + _, err = fmt.Fprintln(cmd.OutOrStdout(), string(out)) + return err + } +} + +// skeletonFlagName returns the name of the skeleton flag that is set, for error +// messages. +func skeletonFlagName(full bool) string { + if full { + return flagSkeletonFull + } + return flagSkeletonRequiredOnly +} + +// jsonSkeleton builds a fillable example value for type t, mirroring how the SDK +// marshals the request: json tag names, pointers dereferenced, slices shown with +// a single element so nested shapes are visible. When requiredOnly is set, only +// fields whose json tag lacks ",omitempty" are kept, matching the SDK's +// required-field convention at every nesting level. seen breaks recursive types +// (e.g. jobs.Task -> ForEachTask -> Task) so the walk terminates. +func jsonSkeleton(t reflect.Type, requiredOnly bool, seen map[reflect.Type]bool) any { + switch t.Kind() { + case reflect.Pointer: + return jsonSkeleton(t.Elem(), requiredOnly, seen) + case reflect.Struct: + if stringScalarTypes[t] { + return "" + } + if seen[t] { + // Recursive type already on the current path; stop expanding it. + return map[string]any{} + } + seen[t] = true + defer delete(seen, t) + obj := map[string]any{} + for f := range t.Fields() { + if f.PkgPath != "" { + continue // unexported + } + name, optional, ok := jsonFieldName(f) + if !ok { + continue // json:"-", e.g. ForceSendFields + } + if requiredOnly && optional { + continue + } + obj[name] = jsonSkeleton(f.Type, requiredOnly, seen) + } + return obj + case reflect.Slice, reflect.Array: + return []any{jsonSkeleton(t.Elem(), requiredOnly, seen)} + case reflect.Map: + return map[string]any{} + case reflect.String: + return "" + case reflect.Bool: + return false + case reflect.Float32, reflect.Float64: + return 0.0 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return 0 + default: + return nil + } +} + +// jsonFieldName returns the JSON object key for a struct field, whether the field +// is optional (its json tag carries ",omitempty"), and whether it is serialized +// at all (false for json:"-"). The SDK marks every optional request field +// ",omitempty" and leaves required fields bare, so omitempty is the required-field +// signal at every nesting level. +func jsonFieldName(f reflect.StructField) (name string, optional, ok bool) { + tag := f.Tag.Get("json") + if tag == "" { + return f.Name, false, true + } + name, opts, _ := strings.Cut(tag, ",") + optional = slices.Contains(strings.Split(opts, ","), "omitempty") + switch name { + case "-": + return "", false, false + case "": + return f.Name, optional, true + default: + return name, optional, true + } +} diff --git a/cmd/root/skeleton_test.go b/cmd/root/skeleton_test.go new file mode 100644 index 00000000000..5ae57f83a78 --- /dev/null +++ b/cmd/root/skeleton_test.go @@ -0,0 +1,256 @@ +package root + +import ( + "bytes" + "encoding/json" + "reflect" + "testing" + "time" + + "github.com/databricks/databricks-sdk-go/common/types/duration" + "github.com/databricks/databricks-sdk-go/common/types/fieldmask" + sdktime "github.com/databricks/databricks-sdk-go/common/types/time" + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func skeletonValue(v any, requiredOnly bool) any { + return jsonSkeleton(reflect.TypeOf(v), requiredOnly, map[reflect.Type]bool{}) +} + +// skeletonJSON builds the full skeleton for the type of v and marshals it, +// mirroring what --generate-skeleton-full prints. Comparing the JSON keeps the +// assertions close to the observed behavior and avoids fighting type-aware lints +// on any values. +func skeletonJSON(t *testing.T, v any) string { + t.Helper() + b, err := json.Marshal(skeletonValue(v, false)) + require.NoError(t, err) + return string(b) +} + +func TestJSONSkeletonPrimitives(t *testing.T) { + assert.Equal(t, `""`, skeletonJSON(t, "")) + assert.Equal(t, `false`, skeletonJSON(t, false)) + assert.Equal(t, `0`, skeletonJSON(t, int64(0))) + assert.Equal(t, `0`, skeletonJSON(t, float64(0))) +} + +func TestJSONSkeletonPointerIsDereferenced(t *testing.T) { + var p *string + assert.Equal(t, `""`, skeletonJSON(t, p)) +} + +func TestJSONSkeletonSliceShowsOneElement(t *testing.T) { + assert.Equal(t, `[""]`, skeletonJSON(t, []string(nil))) +} + +func TestJSONSkeletonMapIsEmptyObject(t *testing.T) { + // Maps have no fixed keys, so the shape is an empty object. + assert.Equal(t, `{}`, skeletonJSON(t, map[string]string(nil))) +} + +func TestJSONSkeletonScalarWrapperTypesAreEmptyString(t *testing.T) { + // The SDK marshals these to a single JSON string, not an object. Reflecting + // into their (unexported) fields would render them as {}, so the skeleton must + // special-case them to "". + cases := []struct { + name string + val any + }{ + {"stdlib time.Time", time.Time{}}, + {"sdk time.Time", sdktime.Time{}}, + {"sdk duration.Duration", duration.Duration{}}, + {"sdk fieldmask.FieldMask", fieldmask.FieldMask{}}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + assert.Equal(t, `""`, skeletonJSON(t, c.val)) + }) + } +} + +func TestJSONSkeletonStructUsesJSONTags(t *testing.T) { + type inner struct { + Value string `json:"value"` + } + type req struct { + Renamed string `json:"renamed"` + Untagged string // no json tag: keeps the Go field name + OmitTag string `json:"omit_tag,omitempty"` + Nested inner `json:"nested"` + Items []inner `json:"items"` + Skipped string `json:"-"` + unexp string //nolint:unused // exercises the unexported-field skip + Force []string `json:"-"` + } + + want := map[string]any{ + "renamed": "", + "Untagged": "", + "omit_tag": "", + "nested": map[string]any{"value": ""}, + "items": []any{map[string]any{"value": ""}}, + } + assert.Equal(t, want, skeletonValue(req{}, false)) +} + +func TestJSONSkeletonRequiredOnlyDropsOmitempty(t *testing.T) { + type inner struct { + Req string `json:"req"` + Opt string `json:"opt,omitempty"` + } + type req struct { + Required string `json:"required"` + Optional string `json:"optional,omitempty"` + // A required nested object keeps only its own required fields. + Nested inner `json:"nested"` + // An optional nested object is dropped entirely. + OptNested inner `json:"opt_nested,omitempty"` + } + + want := map[string]any{ + "required": "", + "nested": map[string]any{"req": ""}, + } + assert.Equal(t, want, skeletonValue(req{}, true)) +} + +func TestJSONSkeletonRequiredOnlyRecursesThroughSlices(t *testing.T) { + type elem struct { + Key string `json:"key"` + Val string `json:"val,omitempty"` + } + type req struct { + Items []elem `json:"items"` + } + + want := map[string]any{"items": []any{map[string]any{"key": ""}}} + assert.Equal(t, want, skeletonValue(req{}, true)) +} + +func TestJSONFieldNameOptionalDetection(t *testing.T) { + type s struct { + Required string `json:"required"` + Optional string `json:"optional,omitempty"` + Renamed string `json:"renamed,omitempty"` + Skipped string `json:"-"` + Untagged string + } + byName := map[string]reflect.StructField{} + st := reflect.TypeFor[s]() + for f := range st.Fields() { + byName[f.Name] = f + } + + cases := []struct { + field string + wantName string + wantOpt bool + wantOK bool + }{ + {"Required", "required", false, true}, + {"Optional", "optional", true, true}, + {"Renamed", "renamed", true, true}, + {"Skipped", "", false, false}, + {"Untagged", "Untagged", false, true}, + } + for _, c := range cases { + name, opt, ok := jsonFieldName(byName[c.field]) + assert.Equal(t, c.wantName, name, c.field) + assert.Equal(t, c.wantOpt, opt, c.field) + assert.Equal(t, c.wantOK, ok, c.field) + } +} + +func TestJSONSkeletonRecursiveTypeTerminates(t *testing.T) { + // A self-referential type would recurse forever without the seen guard; the + // back-edge collapses to an empty object. + type node struct { + Name string `json:"name"` + Child *node `json:"child"` + Kids []*node `json:"kids"` + } + + want := map[string]any{ + "name": "", + "child": map[string]any{}, + "kids": []any{map[string]any{}}, + } + assert.Equal(t, want, skeletonValue(node{}, false)) +} + +// requestBody is a stand-in request struct for the flag-wiring tests. +type requestBody struct { + Name string `json:"name"` + Extra string `json:"extra,omitempty"` +} + +func newSkeletonTestCmd(req *requestBody) *cobra.Command { + cmd := &cobra.Command{ + Use: "create NAME", + Args: cobra.ExactArgs(1), + // Mimic a generated command: --json unmarshals into the request, and the + // real work needs a workspace client. + PreRunE: func(cmd *cobra.Command, args []string) error { + return assert.AnError + }, + RunE: func(cmd *cobra.Command, args []string) error { + return assert.AnError + }, + } + cmd.Flags().String("json", "", "request body") + RegisterGenerateSkeleton(cmd, req) + return cmd +} + +func runSkeletonCmd(t *testing.T, args ...string) (string, error) { + t.Helper() + cmd := newSkeletonTestCmd(&requestBody{}) + var out bytes.Buffer + cmd.SetOut(&out) + cmd.SetErr(&out) + cmd.SetArgs(args) + err := cmd.Execute() + return out.String(), err +} + +func TestRegisterGenerateSkeletonFullOffline(t *testing.T) { + // A skeleton flag must not require positional args or a workspace client. + out, err := runSkeletonCmd(t, "--"+flagSkeletonFull) + require.NoError(t, err) + + var parsed map[string]any + require.NoError(t, json.Unmarshal([]byte(out), &parsed)) + assert.Equal(t, map[string]any{"name": "", "extra": ""}, parsed) +} + +func TestRegisterGenerateSkeletonRequiredOnly(t *testing.T) { + out, err := runSkeletonCmd(t, "--"+flagSkeletonRequiredOnly) + require.NoError(t, err) + + var parsed map[string]any + require.NoError(t, json.Unmarshal([]byte(out), &parsed)) + // Only the required field survives; "extra" is omitempty. + assert.Equal(t, map[string]any{"name": ""}, parsed) +} + +func TestRegisterGenerateSkeletonFlagsMutuallyExclusive(t *testing.T) { + _, err := runSkeletonCmd(t, "--"+flagSkeletonFull, "--"+flagSkeletonRequiredOnly) + require.Error(t, err) + assert.Contains(t, err.Error(), "none of the others can be") +} + +func TestRegisterGenerateSkeletonRejectsJSON(t *testing.T) { + _, err := runSkeletonCmd(t, "--"+flagSkeletonRequiredOnly, "--json", "{}") + require.Error(t, err) + assert.Contains(t, err.Error(), "cannot be combined with --json") +} + +func TestRegisterGenerateSkeletonPreservesNormalPath(t *testing.T) { + // Without a skeleton flag, the original PreRunE runs (returns before the API + // call). + _, err := runSkeletonCmd(t, "some-name") + assert.ErrorIs(t, err, assert.AnError) +} diff --git a/cmd/workspace/access-control/access-control.go b/cmd/workspace/access-control/access-control.go index f3571d21c3f..13cee98c38c 100644 --- a/cmd/workspace/access-control/access-control.go +++ b/cmd/workspace/access-control/access-control.go @@ -108,6 +108,10 @@ func newCheckPolicy() *cobra.Command { fn(cmd, &checkPolicyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &checkPolicyReq) + return cmd } diff --git a/cmd/workspace/agent-bricks/agent-bricks.go b/cmd/workspace/agent-bricks/agent-bricks.go index 145b4198dee..2ee8fd62085 100644 --- a/cmd/workspace/agent-bricks/agent-bricks.go +++ b/cmd/workspace/agent-bricks/agent-bricks.go @@ -189,6 +189,10 @@ func newCreateCustomLlm() *cobra.Command { fn(cmd, &createCustomLlmReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCustomLlmReq) + return cmd } @@ -433,6 +437,10 @@ func newUpdateCustomLlm() *cobra.Command { fn(cmd, &updateCustomLlmReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateCustomLlmReq) + return cmd } diff --git a/cmd/workspace/ai-search/ai-search.go b/cmd/workspace/ai-search/ai-search.go index da9a7d8080e..1a9c2646181 100644 --- a/cmd/workspace/ai-search/ai-search.go +++ b/cmd/workspace/ai-search/ai-search.go @@ -163,6 +163,10 @@ Create an AI Search endpoint. fn(cmd, &createEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createEndpointReq.Endpoint) + return cmd } @@ -268,6 +272,10 @@ Create an AI Search index. fn(cmd, &createIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createIndexReq.Index) + return cmd } @@ -758,6 +766,10 @@ Query an AI Search index. fn(cmd, &queryIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &queryIndexReq) + return cmd } @@ -837,6 +849,10 @@ Remove data from an AI Search index. fn(cmd, &removeDataReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &removeDataReq) + return cmd } @@ -917,6 +933,10 @@ Scan an AI Search index. fn(cmd, &scanIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &scanIndexReq) + return cmd } @@ -1098,6 +1118,10 @@ Update an AI Search endpoint. fn(cmd, &updateEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateEndpointReq.Endpoint) + return cmd } @@ -1186,6 +1210,10 @@ Upsert data into an AI Search index. fn(cmd, &upsertDataReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &upsertDataReq) + return cmd } diff --git a/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go b/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go index 5341051cd12..099dbfe02e3 100644 --- a/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go +++ b/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go @@ -231,6 +231,10 @@ Update the AI/BI dashboard embedding access policy. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go b/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go index 3477f3a0971..59159936c87 100644 --- a/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go +++ b/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go @@ -231,6 +231,10 @@ Update the list of domains approved to host embedded AI/BI dashboards. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/alerts-legacy/alerts-legacy.go b/cmd/workspace/alerts-legacy/alerts-legacy.go index b381f027b2c..a138af4fdd8 100644 --- a/cmd/workspace/alerts-legacy/alerts-legacy.go +++ b/cmd/workspace/alerts-legacy/alerts-legacy.go @@ -132,6 +132,10 @@ Create an alert. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -392,6 +396,10 @@ Update an alert. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/alerts-v2/alerts-v2.go b/cmd/workspace/alerts-v2/alerts-v2.go index 3af56df67af..19c56bcc286 100644 --- a/cmd/workspace/alerts-v2/alerts-v2.go +++ b/cmd/workspace/alerts-v2/alerts-v2.go @@ -162,6 +162,10 @@ Create an alert. fn(cmd, &createAlertReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createAlertReq.Alert) + return cmd } @@ -508,6 +512,10 @@ Update an alert. fn(cmd, &updateAlertReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateAlertReq.Alert) + return cmd } diff --git a/cmd/workspace/alerts/alerts.go b/cmd/workspace/alerts/alerts.go index 3d7ea15c063..c96b980d2dc 100644 --- a/cmd/workspace/alerts/alerts.go +++ b/cmd/workspace/alerts/alerts.go @@ -120,6 +120,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -427,6 +431,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/apps-settings/apps-settings.go b/cmd/workspace/apps-settings/apps-settings.go index ce5e6d84a41..5f6accb9a4e 100644 --- a/cmd/workspace/apps-settings/apps-settings.go +++ b/cmd/workspace/apps-settings/apps-settings.go @@ -156,6 +156,10 @@ func newCreateCustomTemplate() *cobra.Command { fn(cmd, &createCustomTemplateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCustomTemplateReq.Template) + return cmd } @@ -452,6 +456,10 @@ func newUpdateCustomTemplate() *cobra.Command { fn(cmd, &updateCustomTemplateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateCustomTemplateReq.Template) + return cmd } diff --git a/cmd/workspace/apps/apps.go b/cmd/workspace/apps/apps.go index c06e20fa301..cdeb5606b49 100644 --- a/cmd/workspace/apps/apps.go +++ b/cmd/workspace/apps/apps.go @@ -195,6 +195,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.App) + return cmd } @@ -332,6 +336,10 @@ func newCreateSpace() *cobra.Command { fn(cmd, &createSpaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSpaceReq.Space) + return cmd } @@ -455,6 +463,10 @@ func newCreateUpdate() *cobra.Command { fn(cmd, &createUpdateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createUpdateReq) + return cmd } @@ -784,6 +796,10 @@ func newDeploy() *cobra.Command { fn(cmd, &deployReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deployReq.AppDeployment) + return cmd } @@ -1504,6 +1520,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1763,6 +1783,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.App) + return cmd } @@ -1839,6 +1863,10 @@ func newUpdateAppThumbnail() *cobra.Command { fn(cmd, &updateAppThumbnailReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateAppThumbnailReq) + return cmd } @@ -1916,6 +1944,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } @@ -2060,6 +2092,10 @@ func newUpdateSpace() *cobra.Command { fn(cmd, &updateSpaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateSpaceReq.Space) + return cmd } diff --git a/cmd/workspace/artifact-allowlists/artifact-allowlists.go b/cmd/workspace/artifact-allowlists/artifact-allowlists.go index d6fce44ebd1..d960138980b 100644 --- a/cmd/workspace/artifact-allowlists/artifact-allowlists.go +++ b/cmd/workspace/artifact-allowlists/artifact-allowlists.go @@ -188,6 +188,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go index 2ee11c74d41..9ce43f5209c 100644 --- a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go +++ b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go @@ -172,6 +172,10 @@ Update the automatic cluster update setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/bundle-deployments/bundle-deployments.go b/cmd/workspace/bundle-deployments/bundle-deployments.go index b320cd9fba8..89b74dbdab3 100644 --- a/cmd/workspace/bundle-deployments/bundle-deployments.go +++ b/cmd/workspace/bundle-deployments/bundle-deployments.go @@ -155,6 +155,10 @@ func newCompleteVersion() *cobra.Command { fn(cmd, &completeVersionReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &completeVersionReq) + return cmd } @@ -238,6 +242,10 @@ func newCreateDeployment() *cobra.Command { fn(cmd, &createDeploymentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDeploymentReq.Deployment) + return cmd } @@ -331,6 +339,10 @@ func newCreateOperation() *cobra.Command { fn(cmd, &createOperationReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createOperationReq.Operation) + return cmd } @@ -448,6 +460,10 @@ func newCreateVersion() *cobra.Command { fn(cmd, &createVersionReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createVersionReq.Version) + return cmd } diff --git a/cmd/workspace/catalogs/catalogs.go b/cmd/workspace/catalogs/catalogs.go index 0bc03d53555..33feb640066 100644 --- a/cmd/workspace/catalogs/catalogs.go +++ b/cmd/workspace/catalogs/catalogs.go @@ -144,6 +144,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -439,6 +443,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/clean-room-assets/clean-room-assets.go b/cmd/workspace/clean-room-assets/clean-room-assets.go index f335be9f485..5a1502b9b8b 100644 --- a/cmd/workspace/clean-room-assets/clean-room-assets.go +++ b/cmd/workspace/clean-room-assets/clean-room-assets.go @@ -162,6 +162,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.Asset) + return cmd } @@ -249,6 +253,10 @@ Create a review (e.g. approval) for an asset. fn(cmd, &createCleanRoomAssetReviewReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCleanRoomAssetReviewReq) + return cmd } @@ -559,6 +567,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.Asset) + return cmd } diff --git a/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go b/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go index 6ffea68d40d..38c640f819b 100644 --- a/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go +++ b/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go @@ -125,6 +125,10 @@ Create an auto-approval rule. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -400,6 +404,10 @@ Update an auto-approval rule. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.AutoApprovalRule) + return cmd } diff --git a/cmd/workspace/clean-rooms/clean-rooms.go b/cmd/workspace/clean-rooms/clean-rooms.go index 84443530d7f..1e714d1d6c4 100644 --- a/cmd/workspace/clean-rooms/clean-rooms.go +++ b/cmd/workspace/clean-rooms/clean-rooms.go @@ -151,6 +151,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.CleanRoom) + return cmd } @@ -228,6 +232,10 @@ func newCreateOutputCatalog() *cobra.Command { fn(cmd, &createOutputCatalogReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createOutputCatalogReq.OutputCatalog) + return cmd } @@ -495,6 +503,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/cluster-policies/cluster-policies.go b/cmd/workspace/cluster-policies/cluster-policies.go index c601693c28c..d9dcd6f6383 100644 --- a/cmd/workspace/cluster-policies/cluster-policies.go +++ b/cmd/workspace/cluster-policies/cluster-policies.go @@ -147,6 +147,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -245,6 +249,10 @@ func newDelete() *cobra.Command { fn(cmd, &deleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteReq) + return cmd } @@ -352,6 +360,10 @@ func newEdit() *cobra.Command { fn(cmd, &editReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &editReq) + return cmd } @@ -725,6 +737,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -814,6 +830,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/clusters/clusters.go b/cmd/workspace/clusters/clusters.go index 303d5346632..4d5e888d494 100644 --- a/cmd/workspace/clusters/clusters.go +++ b/cmd/workspace/clusters/clusters.go @@ -173,6 +173,10 @@ func newChangeOwner() *cobra.Command { fn(cmd, &changeOwnerReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &changeOwnerReq) + return cmd } @@ -339,6 +343,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -457,6 +465,10 @@ func newDelete() *cobra.Command { fn(cmd, &deleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteReq) + return cmd } @@ -621,6 +633,10 @@ func newEdit() *cobra.Command { fn(cmd, &editReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &editReq) + return cmd } @@ -743,6 +759,10 @@ func newEvents() *cobra.Command { fn(cmd, &eventsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &eventsReq) + return cmd } @@ -1226,6 +1246,10 @@ func newPermanentDelete() *cobra.Command { fn(cmd, &permanentDeleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &permanentDeleteReq) + return cmd } @@ -1322,6 +1346,10 @@ func newPin() *cobra.Command { fn(cmd, &pinReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &pinReq) + return cmd } @@ -1442,6 +1470,10 @@ func newResize() *cobra.Command { fn(cmd, &resizeReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resizeReq) + return cmd } @@ -1561,6 +1593,10 @@ func newRestart() *cobra.Command { fn(cmd, &restartReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &restartReq) + return cmd } @@ -1651,6 +1687,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1818,6 +1858,10 @@ func newStart() *cobra.Command { fn(cmd, &startReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &startReq) + return cmd } @@ -1914,6 +1958,10 @@ func newUnpin() *cobra.Command { fn(cmd, &unpinReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &unpinReq) + return cmd } @@ -2042,6 +2090,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -2131,6 +2183,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/compliance-security-profile/compliance-security-profile.go b/cmd/workspace/compliance-security-profile/compliance-security-profile.go index 0a87f8a7bc9..8832642f2ee 100644 --- a/cmd/workspace/compliance-security-profile/compliance-security-profile.go +++ b/cmd/workspace/compliance-security-profile/compliance-security-profile.go @@ -175,6 +175,10 @@ Update the compliance security profile setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/connections/connections.go b/cmd/workspace/connections/connections.go index eaaa91ad7dc..3244150d337 100644 --- a/cmd/workspace/connections/connections.go +++ b/cmd/workspace/connections/connections.go @@ -127,6 +127,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -426,6 +430,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/consumer-installations/consumer-installations.go b/cmd/workspace/consumer-installations/consumer-installations.go index 7325f18f9cc..ea0062db353 100644 --- a/cmd/workspace/consumer-installations/consumer-installations.go +++ b/cmd/workspace/consumer-installations/consumer-installations.go @@ -125,6 +125,10 @@ Install from a listing. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -411,6 +415,10 @@ Update an installation. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go b/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go index ff2f4c0e55c..18eed758849 100644 --- a/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go +++ b/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go @@ -126,6 +126,10 @@ Create a personalization request. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/workspace/credentials-manager/credentials-manager.go b/cmd/workspace/credentials-manager/credentials-manager.go index 6c960ed692f..583e1445ff2 100644 --- a/cmd/workspace/credentials-manager/credentials-manager.go +++ b/cmd/workspace/credentials-manager/credentials-manager.go @@ -121,6 +121,10 @@ func newExchangeToken() *cobra.Command { fn(cmd, &exchangeTokenReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &exchangeTokenReq) + return cmd } diff --git a/cmd/workspace/credentials/credentials.go b/cmd/workspace/credentials/credentials.go index 60348246c1b..7cecec28e16 100644 --- a/cmd/workspace/credentials/credentials.go +++ b/cmd/workspace/credentials/credentials.go @@ -150,6 +150,10 @@ func newCreateCredential() *cobra.Command { fn(cmd, &createCredentialReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCredentialReq) + return cmd } @@ -299,6 +303,10 @@ func newGenerateTemporaryServiceCredential() *cobra.Command { fn(cmd, &generateTemporaryServiceCredentialReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &generateTemporaryServiceCredentialReq) + return cmd } @@ -532,6 +540,10 @@ func newUpdateCredential() *cobra.Command { fn(cmd, &updateCredentialReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateCredentialReq) + return cmd } @@ -625,6 +637,10 @@ func newValidateCredential() *cobra.Command { fn(cmd, &validateCredentialReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &validateCredentialReq) + return cmd } diff --git a/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go b/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go index b8cb554761f..93242ae4035 100644 --- a/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go +++ b/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go @@ -228,6 +228,10 @@ Update the Dashboard Email Subscriptions setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/dashboard-widgets/dashboard-widgets.go b/cmd/workspace/dashboard-widgets/dashboard-widgets.go index b417deb6c32..c447402bd03 100644 --- a/cmd/workspace/dashboard-widgets/dashboard-widgets.go +++ b/cmd/workspace/dashboard-widgets/dashboard-widgets.go @@ -115,6 +115,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -252,6 +256,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/dashboards/dashboards.go b/cmd/workspace/dashboards/dashboards.go index 5eb7ed2d3a1..a7339400d04 100644 --- a/cmd/workspace/dashboards/dashboards.go +++ b/cmd/workspace/dashboards/dashboards.go @@ -399,6 +399,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/data-classification/data-classification.go b/cmd/workspace/data-classification/data-classification.go index 36a25aac8b5..9b94e1e5fdf 100644 --- a/cmd/workspace/data-classification/data-classification.go +++ b/cmd/workspace/data-classification/data-classification.go @@ -132,6 +132,10 @@ Create config for a catalog. fn(cmd, &createCatalogConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCatalogConfigReq.CatalogConfig) + return cmd } @@ -342,6 +346,10 @@ Update config for a catalog. fn(cmd, &updateCatalogConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateCatalogConfigReq.CatalogConfig) + return cmd } diff --git a/cmd/workspace/data-quality/data-quality.go b/cmd/workspace/data-quality/data-quality.go index b7ed15b8acb..7370ef424ae 100644 --- a/cmd/workspace/data-quality/data-quality.go +++ b/cmd/workspace/data-quality/data-quality.go @@ -268,6 +268,10 @@ Create a monitor. fn(cmd, &createMonitorReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createMonitorReq.Monitor) + return cmd } @@ -369,6 +373,10 @@ Create a refresh. fn(cmd, &createRefreshReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createRefreshReq.Refresh) + return cmd } @@ -1049,6 +1057,10 @@ Update a monitor. fn(cmd, &updateMonitorReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateMonitorReq.Monitor) + return cmd } @@ -1179,6 +1191,10 @@ Update a refresh. fn(cmd, &updateRefreshReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateRefreshReq.Refresh) + return cmd } diff --git a/cmd/workspace/database/database.go b/cmd/workspace/database/database.go index 7171e0421cd..2f864cc164c 100644 --- a/cmd/workspace/database/database.go +++ b/cmd/workspace/database/database.go @@ -159,6 +159,10 @@ Create a Database Catalog. fn(cmd, &createDatabaseCatalogReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDatabaseCatalogReq.Catalog) + return cmd } @@ -273,6 +277,10 @@ Create a Database Instance. fn(cmd, &createDatabaseInstanceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDatabaseInstanceReq.DatabaseInstance) + return cmd } @@ -368,6 +376,10 @@ func newCreateDatabaseInstanceRole() *cobra.Command { fn(cmd, &createDatabaseInstanceRoleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDatabaseInstanceRoleReq.DatabaseInstanceRole) + return cmd } @@ -459,6 +471,10 @@ Create a Database Table. fn(cmd, &createDatabaseTableReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDatabaseTableReq.Table) + return cmd } @@ -548,6 +564,10 @@ Create a Synced Database Table. fn(cmd, &createSyncedDatabaseTableReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSyncedDatabaseTableReq.SyncedTable) + return cmd } @@ -968,6 +988,10 @@ Generates a credential that can be used to access database instances.` fn(cmd, &generateDatabaseCredentialReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &generateDatabaseCredentialReq) + return cmd } @@ -1657,6 +1681,10 @@ func newUpdateDatabaseCatalog() *cobra.Command { fn(cmd, &updateDatabaseCatalogReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateDatabaseCatalogReq.DatabaseCatalog) + return cmd } @@ -1748,6 +1776,10 @@ Update a Database Instance. fn(cmd, &updateDatabaseInstanceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateDatabaseInstanceReq.DatabaseInstance) + return cmd } @@ -1833,6 +1865,10 @@ func newUpdateSyncedDatabaseTable() *cobra.Command { fn(cmd, &updateSyncedDatabaseTableReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateSyncedDatabaseTableReq.SyncedTable) + return cmd } diff --git a/cmd/workspace/default-namespace/default-namespace.go b/cmd/workspace/default-namespace/default-namespace.go index c0ebe0ed600..d0c63cb1a4a 100644 --- a/cmd/workspace/default-namespace/default-namespace.go +++ b/cmd/workspace/default-namespace/default-namespace.go @@ -247,6 +247,10 @@ Update the default namespace setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/default-warehouse-id/default-warehouse-id.go b/cmd/workspace/default-warehouse-id/default-warehouse-id.go index 491ac6b972c..c2f4d1e5833 100644 --- a/cmd/workspace/default-warehouse-id/default-warehouse-id.go +++ b/cmd/workspace/default-warehouse-id/default-warehouse-id.go @@ -222,6 +222,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/disable-legacy-access/disable-legacy-access.go b/cmd/workspace/disable-legacy-access/disable-legacy-access.go index 5a4c9639605..9b97c25b8e5 100644 --- a/cmd/workspace/disable-legacy-access/disable-legacy-access.go +++ b/cmd/workspace/disable-legacy-access/disable-legacy-access.go @@ -223,6 +223,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go b/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go index b624e1bffa8..330a3499b7d 100644 --- a/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go +++ b/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go @@ -227,6 +227,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/enable-export-notebook/enable-export-notebook.go b/cmd/workspace/enable-export-notebook/enable-export-notebook.go index 234e724440d..bd6f91ba029 100644 --- a/cmd/workspace/enable-export-notebook/enable-export-notebook.go +++ b/cmd/workspace/enable-export-notebook/enable-export-notebook.go @@ -159,6 +159,10 @@ Update the Notebook and File exporting setting. fn(cmd, &patchEnableExportNotebookReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchEnableExportNotebookReq) + return cmd } diff --git a/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go b/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go index 48e11680f9f..b5c096a2bad 100644 --- a/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go +++ b/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go @@ -159,6 +159,10 @@ Update the Results Table Clipboard features setting. fn(cmd, &patchEnableNotebookTableClipboardReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchEnableNotebookTableClipboardReq) + return cmd } diff --git a/cmd/workspace/enable-results-downloading/enable-results-downloading.go b/cmd/workspace/enable-results-downloading/enable-results-downloading.go index 9d417344d76..88cf9578f87 100644 --- a/cmd/workspace/enable-results-downloading/enable-results-downloading.go +++ b/cmd/workspace/enable-results-downloading/enable-results-downloading.go @@ -159,6 +159,10 @@ Update the Notebook results download setting. fn(cmd, &patchEnableResultsDownloadingReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchEnableResultsDownloadingReq) + return cmd } diff --git a/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go b/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go index ee5eb69c722..a66667c973d 100644 --- a/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go +++ b/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go @@ -177,6 +177,10 @@ Update the enhanced security monitoring setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go b/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go index d7caf1bbab7..f8fb856e365 100644 --- a/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go +++ b/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go @@ -151,6 +151,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.TagAssignment) + return cmd } @@ -471,6 +475,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.TagAssignment) + return cmd } diff --git a/cmd/workspace/environments/environments.go b/cmd/workspace/environments/environments.go index a11d550a52d..420f1bcd8f1 100644 --- a/cmd/workspace/environments/environments.go +++ b/cmd/workspace/environments/environments.go @@ -191,6 +191,10 @@ func newCreateWorkspaceBaseEnvironment() *cobra.Command { fn(cmd, &createWorkspaceBaseEnvironmentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createWorkspaceBaseEnvironmentReq.WorkspaceBaseEnvironment) + return cmd } @@ -715,6 +719,10 @@ func newUpdateDefaultWorkspaceBaseEnvironment() *cobra.Command { fn(cmd, &updateDefaultWorkspaceBaseEnvironmentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateDefaultWorkspaceBaseEnvironmentReq.DefaultWorkspaceBaseEnvironment) + return cmd } @@ -851,6 +859,10 @@ func newUpdateWorkspaceBaseEnvironment() *cobra.Command { fn(cmd, &updateWorkspaceBaseEnvironmentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateWorkspaceBaseEnvironmentReq.WorkspaceBaseEnvironment) + return cmd } diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index c52160e1cff..0ee87e1dfbf 100644 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -178,6 +178,10 @@ func newCreateExperiment() *cobra.Command { fn(cmd, &createExperimentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createExperimentReq) + return cmd } @@ -265,6 +269,10 @@ func newCreateLoggedModel() *cobra.Command { fn(cmd, &createLoggedModelReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createLoggedModelReq) + return cmd } @@ -344,6 +352,10 @@ func newCreateRun() *cobra.Command { fn(cmd, &createRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createRunReq) + return cmd } @@ -428,6 +440,10 @@ func newDeleteExperiment() *cobra.Command { fn(cmd, &deleteExperimentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteExperimentReq) + return cmd } @@ -624,6 +640,10 @@ func newDeleteRun() *cobra.Command { fn(cmd, &deleteRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteRunReq) + return cmd } @@ -721,6 +741,10 @@ func newDeleteRuns() *cobra.Command { fn(cmd, &deleteRunsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteRunsReq) + return cmd } @@ -808,6 +832,10 @@ func newDeleteTag() *cobra.Command { fn(cmd, &deleteTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteTagReq) + return cmd } @@ -898,6 +926,10 @@ func newFinalizeLoggedModel() *cobra.Command { fn(cmd, &finalizeLoggedModelReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &finalizeLoggedModelReq) + return cmd } @@ -1607,6 +1639,10 @@ func newLogBatch() *cobra.Command { fn(cmd, &logBatchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logBatchReq) + return cmd } @@ -1692,6 +1728,10 @@ func newLogInputs() *cobra.Command { fn(cmd, &logInputsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logInputsReq) + return cmd } @@ -1770,6 +1810,10 @@ func newLogLoggedModelParams() *cobra.Command { fn(cmd, &logLoggedModelParamsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logLoggedModelParamsReq) + return cmd } @@ -1877,6 +1921,10 @@ func newLogMetric() *cobra.Command { fn(cmd, &logMetricReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logMetricReq) + return cmd } @@ -1953,6 +2001,10 @@ func newLogModel() *cobra.Command { fn(cmd, &logModelReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logModelReq) + return cmd } @@ -2037,6 +2089,10 @@ func newLogOutputs() *cobra.Command { fn(cmd, &logOutputsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logOutputsReq) + return cmd } @@ -2129,6 +2185,10 @@ func newLogParam() *cobra.Command { fn(cmd, &logParamReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &logParamReq) + return cmd } @@ -2216,6 +2276,10 @@ func newRestoreExperiment() *cobra.Command { fn(cmd, &restoreExperimentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &restoreExperimentReq) + return cmd } @@ -2302,6 +2366,10 @@ func newRestoreRun() *cobra.Command { fn(cmd, &restoreRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &restoreRunReq) + return cmd } @@ -2399,6 +2467,10 @@ func newRestoreRuns() *cobra.Command { fn(cmd, &restoreRunsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &restoreRunsReq) + return cmd } @@ -2488,6 +2560,10 @@ func newSearchExperiments() *cobra.Command { fn(cmd, &searchExperimentsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &searchExperimentsReq) + return cmd } @@ -2565,6 +2641,10 @@ func newSearchLoggedModels() *cobra.Command { fn(cmd, &searchLoggedModelsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &searchLoggedModelsReq) + return cmd } @@ -2657,6 +2737,10 @@ func newSearchRuns() *cobra.Command { fn(cmd, &searchRunsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &searchRunsReq) + return cmd } @@ -2748,6 +2832,10 @@ func newSetExperimentTag() *cobra.Command { fn(cmd, &setExperimentTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setExperimentTagReq) + return cmd } @@ -2821,6 +2909,10 @@ func newSetLoggedModelTags() *cobra.Command { fn(cmd, &setLoggedModelTagsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setLoggedModelTagsReq) + return cmd } @@ -2899,6 +2991,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -2990,6 +3086,10 @@ func newSetTag() *cobra.Command { fn(cmd, &setTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setTagReq) + return cmd } @@ -3074,6 +3174,10 @@ func newUpdateExperiment() *cobra.Command { fn(cmd, &updateExperimentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateExperimentReq) + return cmd } @@ -3151,6 +3255,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } @@ -3227,6 +3335,10 @@ func newUpdateRun() *cobra.Command { fn(cmd, &updateRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateRunReq) + return cmd } diff --git a/cmd/workspace/external-lineage/external-lineage.go b/cmd/workspace/external-lineage/external-lineage.go index 7d6cec7c938..e362709f687 100644 --- a/cmd/workspace/external-lineage/external-lineage.go +++ b/cmd/workspace/external-lineage/external-lineage.go @@ -152,6 +152,10 @@ Create an external lineage relationship. fn(cmd, &createExternalLineageRelationshipReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createExternalLineageRelationshipReq.ExternalLineageRelationship) + return cmd } @@ -221,6 +225,10 @@ Delete an external lineage relationship. fn(cmd, &deleteExternalLineageRelationshipReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteExternalLineageRelationshipReq) + return cmd } @@ -307,6 +315,10 @@ List external lineage relationships. fn(cmd, &listExternalLineageRelationshipsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &listExternalLineageRelationshipsReq) + return cmd } @@ -421,6 +433,10 @@ Update an external lineage relationship. fn(cmd, &updateExternalLineageRelationshipReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateExternalLineageRelationshipReq.ExternalLineageRelationship) + return cmd } diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index edd702cb4ec..9ad6b33ea70 100644 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -157,6 +157,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -456,6 +460,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/external-metadata/external-metadata.go b/cmd/workspace/external-metadata/external-metadata.go index 3d8e7dac3db..f8b711c0be3 100644 --- a/cmd/workspace/external-metadata/external-metadata.go +++ b/cmd/workspace/external-metadata/external-metadata.go @@ -182,6 +182,10 @@ Create an external metadata object. fn(cmd, &createExternalMetadataReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createExternalMetadataReq.ExternalMetadata) + return cmd } @@ -520,6 +524,10 @@ Update an external metadata object. fn(cmd, &updateExternalMetadataReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateExternalMetadataReq.ExternalMetadata) + return cmd } diff --git a/cmd/workspace/feature-engineering/feature-engineering.go b/cmd/workspace/feature-engineering/feature-engineering.go index 131bef26c49..87327d13d24 100644 --- a/cmd/workspace/feature-engineering/feature-engineering.go +++ b/cmd/workspace/feature-engineering/feature-engineering.go @@ -173,6 +173,10 @@ func newCreateFeature() *cobra.Command { fn(cmd, &createFeatureReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createFeatureReq.Feature) + return cmd } @@ -287,6 +291,10 @@ func newCreateKafkaConfig() *cobra.Command { fn(cmd, &createKafkaConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createKafkaConfigReq.KafkaConfig) + return cmd } @@ -378,6 +386,10 @@ func newCreateMaterializedFeature() *cobra.Command { fn(cmd, &createMaterializedFeatureReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createMaterializedFeatureReq.MaterializedFeature) + return cmd } @@ -500,6 +512,10 @@ func newCreateStream() *cobra.Command { fn(cmd, &createStreamReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createStreamReq.Stream) + return cmd } @@ -1367,6 +1383,10 @@ func newUpdateFeature() *cobra.Command { fn(cmd, &updateFeatureReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateFeatureReq.Feature) + return cmd } @@ -1484,6 +1504,10 @@ func newUpdateKafkaConfig() *cobra.Command { fn(cmd, &updateKafkaConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateKafkaConfigReq.KafkaConfig) + return cmd } @@ -1582,6 +1606,10 @@ func newUpdateMaterializedFeature() *cobra.Command { fn(cmd, &updateMaterializedFeatureReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateMaterializedFeatureReq.MaterializedFeature) + return cmd } @@ -1706,6 +1734,10 @@ func newUpdateStream() *cobra.Command { fn(cmd, &updateStreamReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateStreamReq.Stream) + return cmd } diff --git a/cmd/workspace/feature-store/feature-store.go b/cmd/workspace/feature-store/feature-store.go index bd7800999f9..34315e566a2 100644 --- a/cmd/workspace/feature-store/feature-store.go +++ b/cmd/workspace/feature-store/feature-store.go @@ -145,6 +145,10 @@ func newCreateOnlineStore() *cobra.Command { fn(cmd, &createOnlineStoreReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createOnlineStoreReq.OnlineStore) + return cmd } @@ -458,6 +462,10 @@ func newPublishTable() *cobra.Command { fn(cmd, &publishTableReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &publishTableReq) + return cmd } @@ -549,6 +557,10 @@ func newUpdateOnlineStore() *cobra.Command { fn(cmd, &updateOnlineStoreReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateOnlineStoreReq.OnlineStore) + return cmd } diff --git a/cmd/workspace/forecasting/forecasting.go b/cmd/workspace/forecasting/forecasting.go index 29aa8a08fba..4fa07ead5f8 100644 --- a/cmd/workspace/forecasting/forecasting.go +++ b/cmd/workspace/forecasting/forecasting.go @@ -189,6 +189,10 @@ func newCreateExperiment() *cobra.Command { fn(cmd, &createExperimentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createExperimentReq) + return cmd } diff --git a/cmd/workspace/functions/functions.go b/cmd/workspace/functions/functions.go index 4b00519ea87..4e2ac3b03cc 100644 --- a/cmd/workspace/functions/functions.go +++ b/cmd/workspace/functions/functions.go @@ -121,6 +121,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -468,6 +472,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/genie/genie.go b/cmd/workspace/genie/genie.go index 4b02963878c..044e7e8ef04 100644 --- a/cmd/workspace/genie/genie.go +++ b/cmd/workspace/genie/genie.go @@ -181,6 +181,10 @@ func newCreateMessage() *cobra.Command { fn(cmd, &createMessageReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createMessageReq) + return cmd } @@ -272,6 +276,10 @@ Create message comment. fn(cmd, &createMessageCommentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createMessageCommentReq) + return cmd } @@ -367,6 +375,10 @@ func newCreateSpace() *cobra.Command { fn(cmd, &createSpaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSpaceReq) + return cmd } @@ -853,6 +865,10 @@ Create eval run for benchmarks. fn(cmd, &genieCreateEvalRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &genieCreateEvalRunReq) + return cmd } @@ -1950,6 +1966,10 @@ func newSendMessageFeedback() *cobra.Command { fn(cmd, &sendMessageFeedbackReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &sendMessageFeedbackReq) + return cmd } @@ -2056,6 +2076,10 @@ func newStartConversation() *cobra.Command { fn(cmd, &startConversationReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &startConversationReq) + return cmd } @@ -2195,6 +2219,10 @@ func newUpdateSpace() *cobra.Command { fn(cmd, &updateSpaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateSpaceReq) + return cmd } diff --git a/cmd/workspace/git-credentials/git-credentials.go b/cmd/workspace/git-credentials/git-credentials.go index e942ef21180..c3258b8ab4a 100644 --- a/cmd/workspace/git-credentials/git-credentials.go +++ b/cmd/workspace/git-credentials/git-credentials.go @@ -144,6 +144,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -463,6 +467,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/global-init-scripts/global-init-scripts.go b/cmd/workspace/global-init-scripts/global-init-scripts.go index 674173ea22b..98e96aeae86 100644 --- a/cmd/workspace/global-init-scripts/global-init-scripts.go +++ b/cmd/workspace/global-init-scripts/global-init-scripts.go @@ -141,6 +141,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -434,6 +438,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/grants/grants.go b/cmd/workspace/grants/grants.go index 51ec366bcf9..5de83a6103a 100644 --- a/cmd/workspace/grants/grants.go +++ b/cmd/workspace/grants/grants.go @@ -441,6 +441,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/groups-v2/groups-v2.go b/cmd/workspace/groups-v2/groups-v2.go index 64b5439cb7a..e7bc14f11d9 100644 --- a/cmd/workspace/groups-v2/groups-v2.go +++ b/cmd/workspace/groups-v2/groups-v2.go @@ -134,6 +134,10 @@ Create a new group. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -411,6 +415,10 @@ Update group details. fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -495,6 +503,10 @@ Replace a group. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/instance-pools/instance-pools.go b/cmd/workspace/instance-pools/instance-pools.go index 5a2b996c2e0..b9cc2f9619a 100644 --- a/cmd/workspace/instance-pools/instance-pools.go +++ b/cmd/workspace/instance-pools/instance-pools.go @@ -173,6 +173,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -271,6 +275,10 @@ func newDelete() *cobra.Command { fn(cmd, &deleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteReq) + return cmd } @@ -375,6 +383,10 @@ func newEdit() *cobra.Command { fn(cmd, &editReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &editReq) + return cmd } @@ -736,6 +748,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -825,6 +841,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/instance-profiles/instance-profiles.go b/cmd/workspace/instance-profiles/instance-profiles.go index 8ddbdaf8f2f..ef6e31dbe4f 100644 --- a/cmd/workspace/instance-profiles/instance-profiles.go +++ b/cmd/workspace/instance-profiles/instance-profiles.go @@ -137,6 +137,10 @@ func newAdd() *cobra.Command { fn(cmd, &addReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &addReq) + return cmd } @@ -237,6 +241,10 @@ func newEdit() *cobra.Command { fn(cmd, &editReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &editReq) + return cmd } @@ -381,6 +389,10 @@ func newRemove() *cobra.Command { fn(cmd, &removeReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &removeReq) + return cmd } diff --git a/cmd/workspace/ip-access-lists/ip-access-lists.go b/cmd/workspace/ip-access-lists/ip-access-lists.go index 2916a1d55b0..933cda0aa76 100644 --- a/cmd/workspace/ip-access-lists/ip-access-lists.go +++ b/cmd/workspace/ip-access-lists/ip-access-lists.go @@ -175,6 +175,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -489,6 +493,10 @@ func newReplace() *cobra.Command { fn(cmd, &replaceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &replaceReq) + return cmd } @@ -596,6 +604,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index 0f9ec046da5..1a1fcc1ed92 100644 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -149,6 +149,10 @@ func newCancelAllRuns() *cobra.Command { fn(cmd, &cancelAllRunsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &cancelAllRunsReq) + return cmd } @@ -276,6 +280,10 @@ func newCancelRun() *cobra.Command { fn(cmd, &cancelRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &cancelRunReq) + return cmd } @@ -341,6 +349,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -442,6 +454,10 @@ func newDelete() *cobra.Command { fn(cmd, &deleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteReq) + return cmd } @@ -543,6 +559,10 @@ func newDeleteRun() *cobra.Command { fn(cmd, &deleteRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteRunReq) + return cmd } @@ -1316,6 +1336,10 @@ func newRepairRun() *cobra.Command { fn(cmd, &repairRunReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &repairRunReq) + return cmd } @@ -1383,6 +1407,10 @@ func newReset() *cobra.Command { fn(cmd, &resetReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resetReq) + return cmd } @@ -1523,6 +1551,10 @@ func newRunNow() *cobra.Command { fn(cmd, &runNowReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &runNowReq) + return cmd } @@ -1613,6 +1645,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1733,6 +1769,10 @@ func newSubmit() *cobra.Command { fn(cmd, &submitReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &submitReq) + return cmd } @@ -1838,6 +1878,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -1927,6 +1971,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/knowledge-assistants/knowledge-assistants.go b/cmd/workspace/knowledge-assistants/knowledge-assistants.go index 3714ee727e8..6df25cbb3f8 100644 --- a/cmd/workspace/knowledge-assistants/knowledge-assistants.go +++ b/cmd/workspace/knowledge-assistants/knowledge-assistants.go @@ -154,6 +154,10 @@ Create an example for a Knowledge Assistant. fn(cmd, &createExampleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createExampleReq.Example) + return cmd } @@ -251,6 +255,10 @@ Create a Knowledge Assistant. fn(cmd, &createKnowledgeAssistantReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createKnowledgeAssistantReq.KnowledgeAssistant) + return cmd } @@ -359,6 +367,10 @@ Create a Knowledge Source. fn(cmd, &createKnowledgeSourceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createKnowledgeSourceReq.KnowledgeSource) + return cmd } @@ -1159,6 +1171,10 @@ Set knowledge assistant permissions. fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1319,6 +1335,10 @@ Update an example in a Knowledge Assistant. fn(cmd, &updateExampleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateExampleReq.Example) + return cmd } @@ -1426,6 +1446,10 @@ Update a Knowledge Assistant. fn(cmd, &updateKnowledgeAssistantReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateKnowledgeAssistantReq.KnowledgeAssistant) + return cmd } @@ -1541,6 +1565,10 @@ Update a Knowledge Source. fn(cmd, &updateKnowledgeSourceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateKnowledgeSourceReq.KnowledgeSource) + return cmd } @@ -1620,6 +1648,10 @@ Update knowledge assistant permissions. fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/lakeview/lakeview.go b/cmd/workspace/lakeview/lakeview.go index 4b9949392d6..f46a99203fc 100644 --- a/cmd/workspace/lakeview/lakeview.go +++ b/cmd/workspace/lakeview/lakeview.go @@ -136,6 +136,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.Dashboard) + return cmd } @@ -229,6 +233,10 @@ func newCreateSchedule() *cobra.Command { fn(cmd, &createScheduleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createScheduleReq.Schedule) + return cmd } @@ -322,6 +330,10 @@ func newCreateSubscription() *cobra.Command { fn(cmd, &createSubscriptionReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSubscriptionReq.Subscription) + return cmd } @@ -987,6 +999,10 @@ func newMigrate() *cobra.Command { fn(cmd, &migrateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &migrateReq) + return cmd } @@ -1064,6 +1080,10 @@ func newPublish() *cobra.Command { fn(cmd, &publishReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &publishReq) + return cmd } @@ -1138,6 +1158,10 @@ func newRevert() *cobra.Command { fn(cmd, &revertReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &revertReq) + return cmd } @@ -1335,6 +1359,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq.Dashboard) + return cmd } @@ -1430,6 +1458,10 @@ func newUpdateSchedule() *cobra.Command { fn(cmd, &updateScheduleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateScheduleReq.Schedule) + return cmd } diff --git a/cmd/workspace/libraries/libraries.go b/cmd/workspace/libraries/libraries.go index 92b71e73019..00521e6e65b 100644 --- a/cmd/workspace/libraries/libraries.go +++ b/cmd/workspace/libraries/libraries.go @@ -259,6 +259,10 @@ func newInstall() *cobra.Command { fn(cmd, &installReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &installReq) + return cmd } @@ -327,6 +331,10 @@ func newUninstall() *cobra.Command { fn(cmd, &uninstallReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &uninstallReq) + return cmd } diff --git a/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go b/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go index e7186373e02..f43a00222ff 100644 --- a/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go +++ b/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go @@ -223,6 +223,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/materialized-features/materialized-features.go b/cmd/workspace/materialized-features/materialized-features.go index 8da35540e24..fc71df8cb77 100644 --- a/cmd/workspace/materialized-features/materialized-features.go +++ b/cmd/workspace/materialized-features/materialized-features.go @@ -133,6 +133,10 @@ func newCreateFeatureTag() *cobra.Command { fn(cmd, &createFeatureTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createFeatureTagReq.FeatureTag) + return cmd } @@ -462,6 +466,10 @@ func newUpdateFeatureTag() *cobra.Command { fn(cmd, &updateFeatureTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateFeatureTagReq.FeatureTag) + return cmd } diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index 6a1ef18de8c..88de2523e0d 100644 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -156,6 +156,10 @@ func newAssign() *cobra.Command { fn(cmd, &assignReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &assignReq) + return cmd } @@ -247,6 +251,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -687,6 +695,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -769,6 +781,10 @@ func newUpdateAssignment() *cobra.Command { fn(cmd, &updateAssignmentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateAssignmentReq) + return cmd } diff --git a/cmd/workspace/model-registry/model-registry.go b/cmd/workspace/model-registry/model-registry.go index 2c88d8d7dc1..a20085a1737 100644 --- a/cmd/workspace/model-registry/model-registry.go +++ b/cmd/workspace/model-registry/model-registry.go @@ -191,6 +191,10 @@ func newApproveTransitionRequest() *cobra.Command { fn(cmd, &approveTransitionRequestReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &approveTransitionRequestReq) + return cmd } @@ -284,6 +288,10 @@ func newCreateComment() *cobra.Command { fn(cmd, &createCommentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCommentReq) + return cmd } @@ -372,6 +380,10 @@ func newCreateModel() *cobra.Command { fn(cmd, &createModelReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createModelReq) + return cmd } @@ -464,6 +476,10 @@ func newCreateModelVersion() *cobra.Command { fn(cmd, &createModelVersionReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createModelVersionReq) + return cmd } @@ -565,6 +581,10 @@ func newCreateTransitionRequest() *cobra.Command { fn(cmd, &createTransitionRequestReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createTransitionRequestReq) + return cmd } @@ -638,6 +658,10 @@ func newCreateWebhook() *cobra.Command { fn(cmd, &createWebhookReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createWebhookReq) + return cmd } @@ -1170,6 +1194,10 @@ func newGetLatestVersions() *cobra.Command { fn(cmd, &getLatestVersionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &getLatestVersionsReq) + return cmd } @@ -1789,6 +1817,10 @@ func newRejectTransitionRequest() *cobra.Command { fn(cmd, &rejectTransitionRequestReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &rejectTransitionRequestReq) + return cmd } @@ -1874,6 +1906,10 @@ func newRenameModel() *cobra.Command { fn(cmd, &renameModelReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &renameModelReq) + return cmd } @@ -2113,6 +2149,10 @@ func newSetModelTag() *cobra.Command { fn(cmd, &setModelTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setModelTagReq) + return cmd } @@ -2212,6 +2252,10 @@ func newSetModelVersionTag() *cobra.Command { fn(cmd, &setModelVersionTagReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setModelVersionTagReq) + return cmd } @@ -2290,6 +2334,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -2388,6 +2436,10 @@ func newTestRegistryWebhook() *cobra.Command { fn(cmd, &testRegistryWebhookReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &testRegistryWebhookReq) + return cmd } @@ -2502,6 +2554,10 @@ func newTransitionStage() *cobra.Command { fn(cmd, &transitionStageReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &transitionStageReq) + return cmd } @@ -2589,6 +2645,10 @@ func newUpdateComment() *cobra.Command { fn(cmd, &updateCommentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateCommentReq) + return cmd } @@ -2674,6 +2734,10 @@ func newUpdateModel() *cobra.Command { fn(cmd, &updateModelReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateModelReq) + return cmd } @@ -2763,6 +2827,10 @@ func newUpdateModelVersion() *cobra.Command { fn(cmd, &updateModelVersionReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateModelVersionReq) + return cmd } @@ -2840,6 +2908,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } @@ -2929,6 +3001,10 @@ func newUpdateWebhook() *cobra.Command { fn(cmd, &updateWebhookReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateWebhookReq) + return cmd } diff --git a/cmd/workspace/model-versions/model-versions.go b/cmd/workspace/model-versions/model-versions.go index 039c545ade9..1d4b8663b7e 100644 --- a/cmd/workspace/model-versions/model-versions.go +++ b/cmd/workspace/model-versions/model-versions.go @@ -455,6 +455,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/notification-destinations/notification-destinations.go b/cmd/workspace/notification-destinations/notification-destinations.go index e463527466a..0698c29ac1e 100644 --- a/cmd/workspace/notification-destinations/notification-destinations.go +++ b/cmd/workspace/notification-destinations/notification-destinations.go @@ -119,6 +119,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -378,6 +382,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/online-tables/online-tables.go b/cmd/workspace/online-tables/online-tables.go index d634450328e..5f02498c370 100644 --- a/cmd/workspace/online-tables/online-tables.go +++ b/cmd/workspace/online-tables/online-tables.go @@ -139,6 +139,10 @@ Create an Online Table. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.Table) + return cmd } diff --git a/cmd/workspace/permission-migration/permission-migration.go b/cmd/workspace/permission-migration/permission-migration.go index 3c9b6741b28..fca8ca2839b 100644 --- a/cmd/workspace/permission-migration/permission-migration.go +++ b/cmd/workspace/permission-migration/permission-migration.go @@ -139,6 +139,10 @@ func newMigratePermissions() *cobra.Command { fn(cmd, &migratePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &migratePermissionsReq) + return cmd } diff --git a/cmd/workspace/permissions/permissions.go b/cmd/workspace/permissions/permissions.go index 02bd53c875d..93c8cd84f91 100644 --- a/cmd/workspace/permissions/permissions.go +++ b/cmd/workspace/permissions/permissions.go @@ -287,6 +287,10 @@ func newSet() *cobra.Command { fn(cmd, &setReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setReq) + return cmd } @@ -371,6 +375,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index 3c9f1151e8d..6ed86f68f30 100644 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -218,6 +218,10 @@ func newClone() *cobra.Command { fn(cmd, &cloneReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &cloneReq) + return cmd } @@ -286,6 +290,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -954,6 +962,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1056,6 +1068,10 @@ func newStartUpdate() *cobra.Command { fn(cmd, &startUpdateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &startUpdateReq) + return cmd } @@ -1261,6 +1277,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -1350,6 +1370,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/policies/policies.go b/cmd/workspace/policies/policies.go index dd0938f01df..06a4209221e 100644 --- a/cmd/workspace/policies/policies.go +++ b/cmd/workspace/policies/policies.go @@ -205,6 +205,10 @@ func newCreatePolicy() *cobra.Command { fn(cmd, &createPolicyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createPolicyReq.PolicyInfo) + return cmd } @@ -578,6 +582,10 @@ func newUpdatePolicy() *cobra.Command { fn(cmd, &updatePolicyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePolicyReq.PolicyInfo) + return cmd } diff --git a/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go b/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go index e18a23b556f..56f31bfc78e 100644 --- a/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go +++ b/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go @@ -139,6 +139,10 @@ func newCancelPendingClusterEnforcement() *cobra.Command { fn(cmd, &cancelPendingClusterEnforcementReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &cancelPendingClusterEnforcementReq) + return cmd } @@ -235,6 +239,10 @@ func newEnforceCompliance() *cobra.Command { fn(cmd, &enforceComplianceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &enforceComplianceReq) + return cmd } diff --git a/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go b/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go index 7925735e472..8b78a271246 100644 --- a/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go +++ b/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go @@ -145,6 +145,10 @@ func newEnforceCompliance() *cobra.Command { fn(cmd, &enforceComplianceReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &enforceComplianceReq) + return cmd } diff --git a/cmd/workspace/postgres/postgres.go b/cmd/workspace/postgres/postgres.go index 8ca99ba3ba7..b43446f0e96 100644 --- a/cmd/workspace/postgres/postgres.go +++ b/cmd/workspace/postgres/postgres.go @@ -227,6 +227,10 @@ Create a Branch. fn(cmd, &createBranchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createBranchReq.Branch) + return cmd } @@ -350,6 +354,10 @@ Register a Database in UC. fn(cmd, &createCatalogReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createCatalogReq.Catalog) + return cmd } @@ -472,6 +480,10 @@ func newCreateDataApi() *cobra.Command { fn(cmd, &createDataApiReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDataApiReq.DataApi) + return cmd } @@ -600,6 +612,10 @@ Create a Database. fn(cmd, &createDatabaseReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDatabaseReq.Database) + return cmd } @@ -730,6 +746,10 @@ Create an Endpoint. fn(cmd, &createEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createEndpointReq.Endpoint) + return cmd } @@ -858,6 +878,10 @@ Create a Project. fn(cmd, &createProjectReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createProjectReq.Project) + return cmd } @@ -983,6 +1007,10 @@ Create a Postgres Role for a Branch. fn(cmd, &createRoleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createRoleReq.Role) + return cmd } @@ -1116,6 +1144,10 @@ Create a Synced Database Table. fn(cmd, &createSyncedTableReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSyncedTableReq.SyncedTable) + return cmd } @@ -2061,6 +2093,10 @@ Generate OAuth credentials for a Postgres database. fn(cmd, &generateDatabaseCredentialReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &generateDatabaseCredentialReq) + return cmd } @@ -3345,6 +3381,10 @@ Update a Branch. fn(cmd, &updateBranchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateBranchReq.Branch) + return cmd } @@ -3475,6 +3515,10 @@ func newUpdateDataApi() *cobra.Command { fn(cmd, &updateDataApiReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateDataApiReq.DataApi) + return cmd } @@ -3602,6 +3646,10 @@ Update a Database. fn(cmd, &updateDatabaseReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateDatabaseReq.Database) + return cmd } @@ -3732,6 +3780,10 @@ Update an Endpoint. fn(cmd, &updateEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateEndpointReq.Endpoint) + return cmd } @@ -3863,6 +3915,10 @@ Update a Project. fn(cmd, &updateProjectReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateProjectReq.Project) + return cmd } @@ -3992,6 +4048,10 @@ Update a Postgres Role for a Branch. fn(cmd, &updateRoleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateRoleReq.Role) + return cmd } diff --git a/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go b/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go index c67cac764b0..fbb1343f66f 100644 --- a/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go +++ b/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go @@ -113,6 +113,10 @@ Create a new exchange filter. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -331,6 +335,10 @@ Update exchange filter. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/provider-exchanges/provider-exchanges.go b/cmd/workspace/provider-exchanges/provider-exchanges.go index 7c8484fce1b..f6de7f6ed17 100644 --- a/cmd/workspace/provider-exchanges/provider-exchanges.go +++ b/cmd/workspace/provider-exchanges/provider-exchanges.go @@ -135,6 +135,10 @@ Add an exchange for listing. fn(cmd, &addListingToExchangeReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &addListingToExchangeReq) + return cmd } @@ -204,6 +208,10 @@ Create an exchange. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -669,6 +677,10 @@ Update exchange. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/provider-files/provider-files.go b/cmd/workspace/provider-files/provider-files.go index 6322769d366..813f340b499 100644 --- a/cmd/workspace/provider-files/provider-files.go +++ b/cmd/workspace/provider-files/provider-files.go @@ -117,6 +117,10 @@ Create a file. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -341,6 +345,10 @@ List files. fn(cmd, &listReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &listReq) + return cmd } diff --git a/cmd/workspace/provider-listings/provider-listings.go b/cmd/workspace/provider-listings/provider-listings.go index 844f87041ce..380f9156a17 100644 --- a/cmd/workspace/provider-listings/provider-listings.go +++ b/cmd/workspace/provider-listings/provider-listings.go @@ -115,6 +115,10 @@ Create a listing. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -401,6 +405,10 @@ Update listing. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go b/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go index b86741b6b2a..f56597cd3e5 100644 --- a/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go +++ b/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go @@ -208,6 +208,10 @@ Update personalization request status. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go b/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go index a85c1878af7..5f7ed529b7c 100644 --- a/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go +++ b/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go @@ -255,6 +255,10 @@ Update provider analytics dashboard. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/provider-providers/provider-providers.go b/cmd/workspace/provider-providers/provider-providers.go index 92fb2ea916a..eef97282189 100644 --- a/cmd/workspace/provider-providers/provider-providers.go +++ b/cmd/workspace/provider-providers/provider-providers.go @@ -114,6 +114,10 @@ Create a provider. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -400,6 +404,10 @@ Update provider. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/providers/providers.go b/cmd/workspace/providers/providers.go index 8d234ff712b..8fde252fdc0 100644 --- a/cmd/workspace/providers/providers.go +++ b/cmd/workspace/providers/providers.go @@ -143,6 +143,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -614,6 +618,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go b/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go index b9a515c72cb..f454ed3fde4 100644 --- a/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go +++ b/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go @@ -141,6 +141,10 @@ Create a quality monitor. fn(cmd, &createQualityMonitorReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createQualityMonitorReq.QualityMonitor) + return cmd } @@ -440,6 +444,10 @@ Update a quality monitor. fn(cmd, &updateQualityMonitorReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateQualityMonitorReq.QualityMonitor) + return cmd } diff --git a/cmd/workspace/quality-monitors/quality-monitors.go b/cmd/workspace/quality-monitors/quality-monitors.go index c8d43ee3b7f..873c9e2717e 100644 --- a/cmd/workspace/quality-monitors/quality-monitors.go +++ b/cmd/workspace/quality-monitors/quality-monitors.go @@ -243,6 +243,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -626,6 +630,10 @@ func newRegenerateDashboard() *cobra.Command { fn(cmd, ®enerateDashboardReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, ®enerateDashboardReq) + return cmd } @@ -809,6 +817,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/queries-legacy/queries-legacy.go b/cmd/workspace/queries-legacy/queries-legacy.go index c82909cdca8..482ebfe1ed2 100644 --- a/cmd/workspace/queries-legacy/queries-legacy.go +++ b/cmd/workspace/queries-legacy/queries-legacy.go @@ -143,6 +143,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -496,6 +500,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/queries/queries.go b/cmd/workspace/queries/queries.go index e0eb80cb58c..e5ed290ebe2 100644 --- a/cmd/workspace/queries/queries.go +++ b/cmd/workspace/queries/queries.go @@ -120,6 +120,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -515,6 +519,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go b/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go index 59a1594c7bf..316df0a939a 100644 --- a/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go +++ b/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go @@ -125,6 +125,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -272,6 +276,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/query-visualizations/query-visualizations.go b/cmd/workspace/query-visualizations/query-visualizations.go index 4e2b50c8687..bc2e8f5fa1f 100644 --- a/cmd/workspace/query-visualizations/query-visualizations.go +++ b/cmd/workspace/query-visualizations/query-visualizations.go @@ -117,6 +117,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -269,6 +273,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go b/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go index 8da45672e62..e9cad3c4c4a 100644 --- a/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go +++ b/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go @@ -174,6 +174,10 @@ Create recipient federation policy. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq.Policy) + return cmd } diff --git a/cmd/workspace/recipients/recipients.go b/cmd/workspace/recipients/recipients.go index ca02fb4d904..d376c536029 100644 --- a/cmd/workspace/recipients/recipients.go +++ b/cmd/workspace/recipients/recipients.go @@ -163,6 +163,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -451,6 +455,10 @@ func newRotateToken() *cobra.Command { fn(cmd, &rotateTokenReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &rotateTokenReq) + return cmd } @@ -598,6 +606,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/registered-models/registered-models.go b/cmd/workspace/registered-models/registered-models.go index dea2800643d..ae10c297abe 100644 --- a/cmd/workspace/registered-models/registered-models.go +++ b/cmd/workspace/registered-models/registered-models.go @@ -169,6 +169,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -574,6 +578,10 @@ func newSetAlias() *cobra.Command { fn(cmd, &setAliasReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setAliasReq) + return cmd } @@ -683,6 +691,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/repos/repos.go b/cmd/workspace/repos/repos.go index 174d5850e49..018dedf67b0 100644 --- a/cmd/workspace/repos/repos.go +++ b/cmd/workspace/repos/repos.go @@ -154,6 +154,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -605,6 +609,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -700,6 +708,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -789,6 +801,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go index ca07a765514..267c6098931 100644 --- a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go +++ b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go @@ -245,6 +245,10 @@ Update the restrict workspace admins setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/rfa/rfa.go b/cmd/workspace/rfa/rfa.go index 4c2ba7f0e25..cf7323ca412 100644 --- a/cmd/workspace/rfa/rfa.go +++ b/cmd/workspace/rfa/rfa.go @@ -129,6 +129,10 @@ Create Access Requests. fn(cmd, &batchCreateAccessRequestsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &batchCreateAccessRequestsReq) + return cmd } @@ -317,6 +321,10 @@ Update Access Request Destinations. fn(cmd, &updateAccessRequestDestinationsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateAccessRequestDestinationsReq.AccessRequestDestinations) + return cmd } diff --git a/cmd/workspace/schemas/schemas.go b/cmd/workspace/schemas/schemas.go index 709452cd3a9..4d9657dae1b 100644 --- a/cmd/workspace/schemas/schemas.go +++ b/cmd/workspace/schemas/schemas.go @@ -141,6 +141,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -439,6 +443,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/secrets-uc/secrets-uc.go b/cmd/workspace/secrets-uc/secrets-uc.go index 41fc2f77faa..6bfe54483ce 100644 --- a/cmd/workspace/secrets-uc/secrets-uc.go +++ b/cmd/workspace/secrets-uc/secrets-uc.go @@ -178,6 +178,10 @@ Create a secret. fn(cmd, &createSecretReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSecretReq.Secret) + return cmd } @@ -528,6 +532,10 @@ Update a secret. fn(cmd, &updateSecretReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateSecretReq.Secret) + return cmd } diff --git a/cmd/workspace/secrets/secrets.go b/cmd/workspace/secrets/secrets.go index e3268ccfe6e..067866e0828 100644 --- a/cmd/workspace/secrets/secrets.go +++ b/cmd/workspace/secrets/secrets.go @@ -181,6 +181,10 @@ func newCreateScope() *cobra.Command { fn(cmd, &createScopeReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createScopeReq) + return cmd } @@ -280,6 +284,10 @@ func newDeleteAcl() *cobra.Command { fn(cmd, &deleteAclReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteAclReq) + return cmd } @@ -373,6 +381,10 @@ func newDeleteScope() *cobra.Command { fn(cmd, &deleteScopeReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteScopeReq) + return cmd } @@ -471,6 +483,10 @@ func newDeleteSecret() *cobra.Command { fn(cmd, &deleteSecretReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteSecretReq) + return cmd } @@ -997,6 +1013,10 @@ func newPutAcl() *cobra.Command { fn(cmd, &putAclReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &putAclReq) + return cmd } diff --git a/cmd/workspace/service-principal-secrets-proxy/service-principal-secrets-proxy.go b/cmd/workspace/service-principal-secrets-proxy/service-principal-secrets-proxy.go index 1f0fde3cee8..2b1ee5314db 100644 --- a/cmd/workspace/service-principal-secrets-proxy/service-principal-secrets-proxy.go +++ b/cmd/workspace/service-principal-secrets-proxy/service-principal-secrets-proxy.go @@ -130,6 +130,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/workspace/service-principals-v2/service-principals-v2.go b/cmd/workspace/service-principals-v2/service-principals-v2.go index 2bce2b79cbf..4a9499c4567 100644 --- a/cmd/workspace/service-principals-v2/service-principals-v2.go +++ b/cmd/workspace/service-principals-v2/service-principals-v2.go @@ -132,6 +132,10 @@ Create a service principal. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -411,6 +415,10 @@ Update service principal details. fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -497,6 +505,10 @@ Replace service principal. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/serving-endpoints/serving-endpoints.go b/cmd/workspace/serving-endpoints/serving-endpoints.go index 0bb70086164..97e3d03c78a 100644 --- a/cmd/workspace/serving-endpoints/serving-endpoints.go +++ b/cmd/workspace/serving-endpoints/serving-endpoints.go @@ -246,6 +246,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -336,6 +340,10 @@ Create a new PT serving endpoint.` fn(cmd, &createProvisionedThroughputEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createProvisionedThroughputEndpointReq) + return cmd } @@ -967,6 +975,10 @@ func newPatch() *cobra.Command { fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -1046,6 +1058,10 @@ Update rate limits of a serving endpoint. fn(cmd, &putReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &putReq) + return cmd } @@ -1129,6 +1145,10 @@ func newPutAiGateway() *cobra.Command { fn(cmd, &putAiGatewayReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &putAiGatewayReq) + return cmd } @@ -1220,6 +1240,10 @@ func newQuery() *cobra.Command { fn(cmd, &queryReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &queryReq) + return cmd } @@ -1298,6 +1322,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1398,6 +1426,10 @@ func newUpdateConfig() *cobra.Command { fn(cmd, &updateConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateConfigReq) + return cmd } @@ -1475,6 +1507,10 @@ func newUpdateNotifications() *cobra.Command { fn(cmd, &updateNotificationsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateNotificationsReq) + return cmd } @@ -1552,6 +1588,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } @@ -1650,6 +1690,10 @@ Update config of a PT serving endpoint. fn(cmd, &updateProvisionedThroughputEndpointConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateProvisionedThroughputEndpointConfigReq) + return cmd } diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index 4f3869ae300..701388ec719 100644 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -137,6 +137,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -490,6 +494,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -572,6 +580,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/sql-results-download/sql-results-download.go b/cmd/workspace/sql-results-download/sql-results-download.go index 84e177a4b8b..cb1cedc68d7 100644 --- a/cmd/workspace/sql-results-download/sql-results-download.go +++ b/cmd/workspace/sql-results-download/sql-results-download.go @@ -228,6 +228,10 @@ Update the SQL Results Download setting. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/storage-credentials/storage-credentials.go b/cmd/workspace/storage-credentials/storage-credentials.go index ff64940025f..f48c790f878 100644 --- a/cmd/workspace/storage-credentials/storage-credentials.go +++ b/cmd/workspace/storage-credentials/storage-credentials.go @@ -152,6 +152,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -448,6 +452,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -539,6 +547,10 @@ func newValidate() *cobra.Command { fn(cmd, &validateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &validateReq) + return cmd } diff --git a/cmd/workspace/supervisor-agents/supervisor-agents.go b/cmd/workspace/supervisor-agents/supervisor-agents.go index f5532315c24..27ae8fbe5f8 100644 --- a/cmd/workspace/supervisor-agents/supervisor-agents.go +++ b/cmd/workspace/supervisor-agents/supervisor-agents.go @@ -160,6 +160,10 @@ Create an example for a Supervisor Agent. fn(cmd, &createExampleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createExampleReq.Example) + return cmd } @@ -250,6 +254,10 @@ Create a Supervisor Agent. fn(cmd, &createSupervisorAgentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createSupervisorAgentReq.SupervisorAgent) + return cmd } @@ -361,6 +369,10 @@ Create a Tool. fn(cmd, &createToolReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createToolReq.Tool) + return cmd } @@ -1161,6 +1173,10 @@ Set supervisor agent permissions. fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1266,6 +1282,10 @@ Update an example in a Supervisor Agent. fn(cmd, &updateExampleReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateExampleReq.Example) + return cmd } @@ -1345,6 +1365,10 @@ Update supervisor agent permissions. fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } @@ -1444,6 +1468,10 @@ Update a Supervisor Agent. fn(cmd, &updateSupervisorAgentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateSupervisorAgentReq.SupervisorAgent) + return cmd } @@ -1554,6 +1582,10 @@ Update a Tool. fn(cmd, &updateToolReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateToolReq.Tool) + return cmd } diff --git a/cmd/workspace/system-schemas/system-schemas.go b/cmd/workspace/system-schemas/system-schemas.go index f29cd30a16d..042cebab53a 100644 --- a/cmd/workspace/system-schemas/system-schemas.go +++ b/cmd/workspace/system-schemas/system-schemas.go @@ -187,6 +187,10 @@ Enable a system schema. fn(cmd, &enableReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &enableReq) + return cmd } diff --git a/cmd/workspace/table-constraints/table-constraints.go b/cmd/workspace/table-constraints/table-constraints.go index 021cd317763..4ae5ed9546e 100644 --- a/cmd/workspace/table-constraints/table-constraints.go +++ b/cmd/workspace/table-constraints/table-constraints.go @@ -128,6 +128,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } diff --git a/cmd/workspace/tables/tables.go b/cmd/workspace/tables/tables.go index 38a13f87171..0f4125378c9 100644 --- a/cmd/workspace/tables/tables.go +++ b/cmd/workspace/tables/tables.go @@ -235,6 +235,10 @@ Create a table. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -706,6 +710,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/tag-policies/tag-policies.go b/cmd/workspace/tag-policies/tag-policies.go index 82c31bd1fb4..cf3c6f8c488 100644 --- a/cmd/workspace/tag-policies/tag-policies.go +++ b/cmd/workspace/tag-policies/tag-policies.go @@ -138,6 +138,10 @@ func newCreateTagPolicy() *cobra.Command { fn(cmd, &createTagPolicyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createTagPolicyReq.TagPolicy) + return cmd } @@ -428,6 +432,10 @@ func newUpdateTagPolicy() *cobra.Command { fn(cmd, &updateTagPolicyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateTagPolicyReq.TagPolicy) + return cmd } diff --git a/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go b/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go index aae3cdd0d0d..358a6cd4469 100644 --- a/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go +++ b/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go @@ -166,6 +166,10 @@ func newGenerateTemporaryPathCredentials() *cobra.Command { fn(cmd, &generateTemporaryPathCredentialsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &generateTemporaryPathCredentialsReq) + return cmd } diff --git a/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go b/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go index 7ec127cbb05..e3f8609123e 100644 --- a/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go +++ b/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go @@ -128,6 +128,10 @@ func newGenerateTemporaryTableCredentials() *cobra.Command { fn(cmd, &generateTemporaryTableCredentialsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &generateTemporaryTableCredentialsReq) + return cmd } diff --git a/cmd/workspace/temporary-volume-credentials/temporary-volume-credentials.go b/cmd/workspace/temporary-volume-credentials/temporary-volume-credentials.go index d503dba3a08..18ceeb5008b 100644 --- a/cmd/workspace/temporary-volume-credentials/temporary-volume-credentials.go +++ b/cmd/workspace/temporary-volume-credentials/temporary-volume-credentials.go @@ -132,6 +132,10 @@ Generate a temporary volume credential. fn(cmd, &generateTemporaryVolumeCredentialsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &generateTemporaryVolumeCredentialsReq) + return cmd } diff --git a/cmd/workspace/token-management/token-management.go b/cmd/workspace/token-management/token-management.go index ebbcdd9d8dd..925070ed491 100644 --- a/cmd/workspace/token-management/token-management.go +++ b/cmd/workspace/token-management/token-management.go @@ -153,6 +153,10 @@ func newCreateOboToken() *cobra.Command { fn(cmd, &createOboTokenReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createOboTokenReq) + return cmd } @@ -528,6 +532,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -601,6 +609,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } @@ -677,6 +689,10 @@ func newUpdateTokenManagement() *cobra.Command { fn(cmd, &updateTokenManagementReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateTokenManagementReq) + return cmd } diff --git a/cmd/workspace/tokens/tokens.go b/cmd/workspace/tokens/tokens.go index 40ca4b786e9..1705527dd8e 100644 --- a/cmd/workspace/tokens/tokens.go +++ b/cmd/workspace/tokens/tokens.go @@ -121,6 +121,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -221,6 +225,10 @@ func newDelete() *cobra.Command { fn(cmd, &deleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteReq) + return cmd } @@ -357,6 +365,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/users-v2/users-v2.go b/cmd/workspace/users-v2/users-v2.go index 3d7b0c63415..7f2dee58535 100644 --- a/cmd/workspace/users-v2/users-v2.go +++ b/cmd/workspace/users-v2/users-v2.go @@ -144,6 +144,10 @@ Create a new user. fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -534,6 +538,10 @@ Update user details. fn(cmd, &patchReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchReq) + return cmd } @@ -610,6 +618,10 @@ Set password permissions. fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -696,6 +708,10 @@ Replace a user. fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -771,6 +787,10 @@ Update password permissions. fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go index bc4e7d83428..c2a76f9bfb3 100644 --- a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go +++ b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go @@ -171,6 +171,10 @@ func newCreateEndpoint() *cobra.Command { fn(cmd, &createEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createEndpointReq) + return cmd } @@ -553,6 +557,10 @@ Update an endpoint. fn(cmd, &patchEndpointReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchEndpointReq) + return cmd } @@ -633,6 +641,10 @@ func newRetrieveUserVisibleMetrics() *cobra.Command { fn(cmd, &retrieveUserVisibleMetricsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &retrieveUserVisibleMetricsReq) + return cmd } @@ -711,6 +723,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -798,6 +814,10 @@ Update the budget policy of an endpoint. fn(cmd, &updateEndpointBudgetPolicyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateEndpointBudgetPolicyReq) + return cmd } @@ -875,6 +895,10 @@ func newUpdateEndpointCustomTags() *cobra.Command { fn(cmd, &updateEndpointCustomTagsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateEndpointCustomTagsReq) + return cmd } @@ -952,6 +976,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/vector-search-indexes/vector-search-indexes.go b/cmd/workspace/vector-search-indexes/vector-search-indexes.go index a1b9bddfcfa..c59024969ce 100644 --- a/cmd/workspace/vector-search-indexes/vector-search-indexes.go +++ b/cmd/workspace/vector-search-indexes/vector-search-indexes.go @@ -160,6 +160,10 @@ func newCreateIndex() *cobra.Command { fn(cmd, &createIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createIndexReq) + return cmd } @@ -237,6 +241,10 @@ func newDeleteDataVectorIndex() *cobra.Command { fn(cmd, &deleteDataVectorIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteDataVectorIndexReq) + return cmd } @@ -513,6 +521,10 @@ func newQueryIndex() *cobra.Command { fn(cmd, &queryIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &queryIndexReq) + return cmd } @@ -591,6 +603,10 @@ func newQueryNextPage() *cobra.Command { fn(cmd, &queryNextPageReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &queryNextPageReq) + return cmd } @@ -669,6 +685,10 @@ func newScanIndex() *cobra.Command { fn(cmd, &scanIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &scanIndexReq) + return cmd } @@ -813,6 +833,10 @@ func newUpsertDataVectorIndex() *cobra.Command { fn(cmd, &upsertDataVectorIndexReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &upsertDataVectorIndexReq) + return cmd } diff --git a/cmd/workspace/volumes/volumes.go b/cmd/workspace/volumes/volumes.go index 1361f293c8c..0e8e9cda1ed 100644 --- a/cmd/workspace/volumes/volumes.go +++ b/cmd/workspace/volumes/volumes.go @@ -175,6 +175,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -517,6 +521,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } diff --git a/cmd/workspace/warehouses/warehouses.go b/cmd/workspace/warehouses/warehouses.go index 11391ede839..265c3410cdf 100644 --- a/cmd/workspace/warehouses/warehouses.go +++ b/cmd/workspace/warehouses/warehouses.go @@ -169,6 +169,10 @@ func newCreate() *cobra.Command { fn(cmd, &createReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createReq) + return cmd } @@ -268,6 +272,10 @@ Create default warehouse override. fn(cmd, &createDefaultWarehouseOverrideReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createDefaultWarehouseOverrideReq.DefaultWarehouseOverride) + return cmd } @@ -539,6 +547,10 @@ func newEdit() *cobra.Command { fn(cmd, &editReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &editReq) + return cmd } @@ -1111,6 +1123,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -1192,6 +1208,10 @@ func newSetWorkspaceWarehouseConfig() *cobra.Command { fn(cmd, &setWorkspaceWarehouseConfigReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setWorkspaceWarehouseConfigReq) + return cmd } @@ -1488,6 +1508,10 @@ Update default warehouse override. fn(cmd, &updateDefaultWarehouseOverrideReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateDefaultWarehouseOverrideReq.DefaultWarehouseOverride) + return cmd } @@ -1577,6 +1601,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/cmd/workspace/workspace-bindings/workspace-bindings.go b/cmd/workspace/workspace-bindings/workspace-bindings.go index eac23b59514..37ee3caf086 100644 --- a/cmd/workspace/workspace-bindings/workspace-bindings.go +++ b/cmd/workspace/workspace-bindings/workspace-bindings.go @@ -284,6 +284,10 @@ func newUpdate() *cobra.Command { fn(cmd, &updateReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateReq) + return cmd } @@ -365,6 +369,10 @@ func newUpdateBindings() *cobra.Command { fn(cmd, &updateBindingsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateBindingsReq) + return cmd } diff --git a/cmd/workspace/workspace-conf/workspace-conf.go b/cmd/workspace/workspace-conf/workspace-conf.go index 8da40a559d7..0d8c34170b6 100644 --- a/cmd/workspace/workspace-conf/workspace-conf.go +++ b/cmd/workspace/workspace-conf/workspace-conf.go @@ -162,6 +162,10 @@ func newSetStatus() *cobra.Command { fn(cmd, &setStatusReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setStatusReq) + return cmd } diff --git a/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go b/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go index e2f8495682e..0f047215e98 100644 --- a/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go +++ b/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go @@ -144,6 +144,10 @@ Create a tag assignment for an entity. fn(cmd, &createTagAssignmentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createTagAssignmentReq.TagAssignment) + return cmd } @@ -458,6 +462,10 @@ Update a tag assignment for an entity. fn(cmd, &updateTagAssignmentReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateTagAssignmentReq.TagAssignment) + return cmd } diff --git a/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go b/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go index d028c27a185..589831de82c 100644 --- a/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go +++ b/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go @@ -150,6 +150,10 @@ func newCreateWorkspaceAssignmentDetailProxy() *cobra.Command { fn(cmd, &createWorkspaceAssignmentDetailProxyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &createWorkspaceAssignmentDetailProxyReq.WorkspaceAssignmentDetail) + return cmd } @@ -509,6 +513,10 @@ Resolve an external group in the Databricks account. fn(cmd, &resolveGroupProxyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resolveGroupProxyReq) + return cmd } @@ -596,6 +604,10 @@ Resolve an external service principal in the Databricks account. fn(cmd, &resolveServicePrincipalProxyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resolveServicePrincipalProxyReq) + return cmd } @@ -683,6 +695,10 @@ Resolve an external user in the Databricks account. fn(cmd, &resolveUserProxyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &resolveUserProxyReq) + return cmd } @@ -791,6 +807,10 @@ func newUpdateWorkspaceAssignmentDetailProxy() *cobra.Command { fn(cmd, &updateWorkspaceAssignmentDetailProxyReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updateWorkspaceAssignmentDetailProxyReq.WorkspaceAssignmentDetail) + return cmd } diff --git a/cmd/workspace/workspace-settings-v2/workspace-settings-v2.go b/cmd/workspace/workspace-settings-v2/workspace-settings-v2.go index 9f3f722e1d9..11cd43381de 100644 --- a/cmd/workspace/workspace-settings-v2/workspace-settings-v2.go +++ b/cmd/workspace/workspace-settings-v2/workspace-settings-v2.go @@ -286,6 +286,10 @@ Update a workspace setting. fn(cmd, &patchPublicWorkspaceSettingReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &patchPublicWorkspaceSettingReq.Setting) + return cmd } diff --git a/cmd/workspace/workspace/workspace.go b/cmd/workspace/workspace/workspace.go index 97c47f80ac0..2cc3a860a35 100644 --- a/cmd/workspace/workspace/workspace.go +++ b/cmd/workspace/workspace/workspace.go @@ -160,6 +160,10 @@ func newDelete() *cobra.Command { fn(cmd, &deleteReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &deleteReq) + return cmd } @@ -537,6 +541,10 @@ func newImport() *cobra.Command { fn(cmd, &importReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &importReq) + return cmd } @@ -716,6 +724,10 @@ func newMkdirs() *cobra.Command { fn(cmd, &mkdirsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &mkdirsReq) + return cmd } @@ -798,6 +810,10 @@ func newSetPermissions() *cobra.Command { fn(cmd, &setPermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &setPermissionsReq) + return cmd } @@ -879,6 +895,10 @@ func newUpdatePermissions() *cobra.Command { fn(cmd, &updatePermissionsReq) } + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + root.RegisterGenerateSkeleton(cmd, &updatePermissionsReq) + return cmd } diff --git a/internal/cligen/skeleton_test.go b/internal/cligen/skeleton_test.go new file mode 100644 index 00000000000..2f71242cb7f --- /dev/null +++ b/internal/cligen/skeleton_test.go @@ -0,0 +1,88 @@ +package main + +import ( + "strings" + "testing" +) + +// renderSkeletonService renders service.go.tmpl for a service whose methods +// exercise the --generate-skeleton wiring, and returns the generated source. +func renderSkeletonService(t *testing.T) string { + t.Helper() + + svc := &ServiceJSON{ + Name: "TestService", + Package: &PackageRef{Name: "testpkg"}, + DocsGroup: "testgroup", + Methods: []*MethodJSON{ + { + // JSON command whose body is the whole request. + Name: "Create", + CanUseJson: true, + Request: &EntityJSON{PascalName: "CreateRequest"}, + Response: &EntityJSON{IsEmptyResponse: true}, + }, + { + // JSON command whose body is a nested request field. + Name: "Update", + CanUseJson: true, + Request: &EntityJSON{PascalName: "UpdateRequest"}, + RequestBodyField: &FieldJSON{Name: "resource", Entity: &EntityJSON{PascalName: "Resource", IsObject: true}}, + AllFields: []*FieldJSON{{Name: "resource", IsRequestBodyField: true, Entity: &EntityJSON{PascalName: "Resource", IsObject: true}}}, + Response: &EntityJSON{IsEmptyResponse: true}, + }, + { + // Non-JSON command must not get the flag. + Name: "Get", + CanUseJson: false, + Request: &EntityJSON{PascalName: "GetRequest"}, + Response: &EntityJSON{IsEmptyResponse: true}, + }, + }, + } + batch := &CommandsBlock{Services: []*ServiceJSON{svc}} + if err := batch.Resolve(); err != nil { + t.Fatalf("resolve: %v", err) + } + + tmpl := parseTemplate("service", "templates/service.go.tmpl") + var sb strings.Builder + if err := tmpl.ExecuteTemplate(&sb, "service.go.tmpl", svc); err != nil { + t.Fatalf("render: %v", err) + } + return sb.String() +} + +func TestTemplateWiresGenerateSkeleton(t *testing.T) { + src := renderSkeletonService(t) + + // Plain request body: skeleton targets the request struct itself. + if !strings.Contains(src, "root.RegisterGenerateSkeleton(cmd, &createReq)") { + t.Errorf("expected skeleton call for Create targeting &createReq\n%s", src) + } + + // Request-body-field command: skeleton targets the body field, matching the + // --json unmarshal target. + if !strings.Contains(src, "root.RegisterGenerateSkeleton(cmd, &updateReq.Resource)") { + t.Errorf("expected skeleton call for Update targeting &updateReq.Resource\n%s", src) + } + + // The skeleton target must match the --json unmarshal target for that method. + if !strings.Contains(src, "updateJson.Unmarshal(&updateReq.Resource)") { + t.Errorf("expected --json unmarshal into &updateReq.Resource\n%s", src) + } +} + +func TestTemplateSkipsGenerateSkeletonForNonJSON(t *testing.T) { + src := renderSkeletonService(t) + + // Get does not accept --json, so it gets no skeleton flag. Exactly the two + // JSON commands (Create, Update) are wired; count so a rename can't make the + // absence check pass vacuously. + if got := strings.Count(src, "root.RegisterGenerateSkeleton("); got != 2 { + t.Errorf("expected 2 skeleton calls (Create, Update), got %d\n%s", got, src) + } + if strings.Contains(src, "root.RegisterGenerateSkeleton(cmd, &getReq)") { + t.Errorf("did not expect a skeleton call for the non-JSON Get command\n%s", src) + } +} diff --git a/internal/cligen/templates/service.go.tmpl b/internal/cligen/templates/service.go.tmpl index 444780b5a82..a3a3d46a727 100644 --- a/internal/cligen/templates/service.go.tmpl +++ b/internal/cligen/templates/service.go.tmpl @@ -506,6 +506,12 @@ func new{{.PascalName}}() *cobra.Command { for _, fn := range {{.CamelName}}Overrides { fn(cmd{{if not .IsLegacyEmptyRequest}}, &{{.CamelName}}Req{{end}}) } + {{- if $canUseJson }} + + // Register --generate-skeleton after overrides so it wraps any RunE they + // installed; --generate-skeleton then short-circuits the whole command. + {{template "generate-skeleton" .}} + {{- end }} return cmd } @@ -628,3 +634,12 @@ func new{{.PascalName}}() *cobra.Command { {{- $field := .Field -}} {{$method.CamelName}}Req{{ if (and $method.RequestBodyField (and (not $field.IsPath) (not $field.IsQuery))) }}.{{$method.RequestBodyField.PascalName}}{{end}}.{{$field.PascalName}} {{- end -}} + +{{- /* generate-skeleton registers the --generate-skeleton flag on a command that + accepts a --json request body. The skeleton target mirrors the --json + unmarshal target above (&{{.CamelName}}Req or its RequestBodyField), so the + printed template always matches what --json accepts. Only rendered for + methods where $canUseJson holds, which implies a non-legacy-empty request. */ -}} +{{- define "generate-skeleton" -}} + root.RegisterGenerateSkeleton(cmd, &{{.CamelName}}Req{{ if .RequestBodyField }}.{{.RequestBodyField.PascalName}}{{ end }}) +{{- end -}}