Skip to content

feat(completion): complete session aliases and config keys#303

Merged
jongio merged 2 commits into
mainfrom
idea/dynamic-completion
Jul 14, 2026
Merged

feat(completion): complete session aliases and config keys#303
jongio merged 2 commits into
mainfrom
idea/dynamic-completion

Conversation

@jongio

@jongio jongio commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Adds dynamic values to shell completion so open aliases and config keys complete without typing.

What changed

  • New hidden dispatch __complete <kind> command that prints newline-separated candidates for a kind. Supported kinds: aliases (configured session aliases), config-keys (settable config keys), and shells (the supported completion shells).
  • The bash, zsh, fish, and PowerShell completion scripts now call __complete at the right positions:
    • dispatch open <TAB> completes session aliases.
    • dispatch config get <TAB> (and set/unset) completes config keys.
    • dispatch completion <TAB> completes the shells, now sourced from __complete.
  • Completion stays fast: aliases read local config and config keys come from the settable field list.
  • Unknown kinds print nothing and exit zero, so a completer never breaks. The __complete command is left out of help and usage.
  • README notes that completion includes dynamic values.

Tests

  • runComplete unit tests: config-keys count and membership, sorted aliases, empty aliases, silent behavior on config load error, shells output, unknown kind, and no kind.
  • handleArgs __complete returns done with no error, and a test asserts help output does not advertise __complete.
  • Full suite green: go build, go vet, go test ./..., golangci-lint (0 issues), and deadcode all pass.

Closes #298

Shell completion only offered static tokens before: command names,
flags, shell names, and config subcommands. The values you actually
reach for, session aliases for `dispatch open` and config keys for
`dispatch config get`/`set`/`unset`, still had to be typed by hand.

Add a hidden `dispatch __complete <kind>` command that prints
newline-separated candidates for a kind (aliases, config-keys, shells)
and wire the bash, zsh, fish, and PowerShell scripts to call it at the
right argument positions. Aliases read local config and config keys come
from the settable field list, so each lookup stays fast. Unknown kinds
print nothing and exit zero so a completer never breaks, and the command
is left out of help and usage.

Closes #298

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 12, 2026
@jongio jongio self-assigned this Jul 12, 2026
@jongio jongio merged commit 9ad5dde into main Jul 14, 2026
2 checks passed
@jongio jongio deleted the idea/dynamic-completion branch July 14, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dynamic shell completion for aliases and config keys

1 participant