Skip to content

feat(cluster): add shell completion for cluster names - #139

Open
Marius MJ (M99) wants to merge 2 commits into
mainfrom
feat/cluster-name-completion
Open

Marius MJ (M99) wants to merge 2 commits into
mainfrom
feat/cluster-name-completion

Conversation

@M99

Copy link
Copy Markdown
Contributor

Summary

Closes #122. Instead of accepting partial names, this adds tab completion for cluster names.

  • New pkg/completion package with ClusterNames, ClusterNameArg and RegisterClusterNameFlag
  • Wired into the positional name and --name/--cluster flags of cluster get, status, login, open, delete, access list/grant/revoke and pullsecret set
  • Completion never triggers an interactive sign-in. It returns no suggestions if you're not signed in, if ListClusters fails, or after 3 seconds.
  • Completion requests (__complete, __completeNoDesc) use a no-op tracer and don't start a telemetry upload, so a Tab press doesn't record a trace
  • File completion is disabled globally (SetDefaultShellCompDirective(NoFileComp)), since no command takes a file path

Existing completion scripts pick this up without changes, because they ask the binary for suggestions at Tab time.

Testing

  • Table-driven unit tests in pkg/completion/completion_test.go
  • Manually checked with indev __complete cluster get "" against a local API

🤖 Generated with Claude Code

Marius MJ (M99) and others added 2 commits October 5, 2026 15:55
Suggest cluster names on tab for the positional name argument and the
--name/--cluster flags of cluster get, status, login, open, delete,
access list/grant/revoke and pullsecret set. Completion stays silent
when not signed in, on API errors, or after a 3s timeout.

Completion requests skip telemetry, and file completion is disabled
globally since no command takes a file path.

Closes #122

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep shared helpers (timeout, signed-in check) in completion.go so
completions for other resources can be added as separate files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow incomplete names as arguments

1 participant