Skip to content

Commit fe502f5

Browse files
committed
Fix kubectl --context and --cluster completions for persistent flags
Wire up the 'context' and 'cluster' generators to the persistent --context and --cluster options on the root kubectl command. Previously these options had no generatorName, so completions like 'kubectl get --context <Tab>' would not suggest context names. Also fix a typo in the CLUSTER_GENERATOR: 'config get_clusters' (underscore) should be 'config get-clusters' (hyphen), matching the actual kubectl subcommand. Fixes: APP-3477 Refs: warpdotdev/warp#5186 Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 8fafc3f commit fe502f5

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

command-signatures/json/kubectl.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7039,15 +7039,19 @@
70397039
{
70407040
"name": "--cluster",
70417041
"args": {
7042-
"name": "cluster"
7042+
"name": "cluster",
7043+
"generatorName": "cluster",
7044+
"skipGeneratorValidation": false
70437045
},
70447046
"description": "The name of the kubeconfig cluster to use",
70457047
"isPersistent": true
70467048
},
70477049
{
70487050
"name": "--context",
70497051
"args": {
7050-
"name": "context"
7052+
"name": "context",
7053+
"generatorName": "context",
7054+
"skipGeneratorValidation": false
70517055
},
70527056
"description": "The name of the kubeconfig context to use",
70537057
"isPersistent": true

command-signatures/src/generators/kubectl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ lazy_static! {
182182
);
183183
pub(super) static ref CLUSTER_GENERATOR: Generator =
184184
Generator::command_from_tokens(
185-
|tokens, _, env_vars| kubectl_script(env_vars, tokens, CommandBuilder::single_command("config get_clusters")),
185+
|tokens, _, env_vars| kubectl_script(env_vars, tokens, CommandBuilder::single_command("config get-clusters")),
186186
|output| match KubetctlStatus::from_output(output) {
187187
KubetctlStatus::ConnectedToCluster | KubetctlStatus::GeneralError => {
188188
GeneratorResults::default()

0 commit comments

Comments
 (0)