Skip to content

Add dynamic shell completion for aliases and config keys #298

Description

@jongio

Problem

The shell completion scripts only complete static tokens (command names, flags, shell names, config subcommands). They cannot complete the values that matter most day to day: session aliases for dispatch open, or config keys for dispatch config get/set/unset. You still have to type or paste those by hand.

Proposed solution

Add a hidden dispatch __complete <what> command that prints newline-separated candidates for a given kind, then wire the four completion scripts to call it for the right argument positions. Kinds to support:

  • aliases reads the configured session aliases.
  • config-keys lists the settable config keys.
  • shells lists the supported completion shells.

Completion stays fast because each kind reads only local config or a static list. Unknown kinds print nothing and exit zero so a completer never breaks.

Acceptance criteria

  • dispatch open <TAB> completes configured session aliases in bash, zsh, fish, and PowerShell.
  • dispatch config get <TAB> (and set/unset) completes config keys.
  • dispatch completion <TAB> still completes the four shells, now sourced from __complete.
  • dispatch __complete <unknown> prints nothing and exits zero.
  • The __complete command is not advertised in help or usage.
  • README notes that completion includes dynamic values and tests cover each kind and the unknown case.

Complexity

M

Priority

Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestideaFeature idea from the idea pipeline

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions