block-open-source / goose

Goose is a developer agent that operates from your command line to help you do the boring stuff.
https://block-open-source.github.io/goose/
Apache License 2.0
73 stars 12 forks source link

feat: add shell-completions subcommand #76

Closed lamchau closed 6 days ago

lamchau commented 1 week ago

extracted from an experimental 'daemon/lsp mode' branch which may overhaul how session management is handled. at the very least, landing this would be a good starting point to enable discoverability of commands and adoption.

this can only be tested via an entrypoint (i.e. installed not via uv)

pipx install . --preinstall goose-plugins-block --force

Usage

This will install to the set user-defined $SHELL

goose shell-completions --install
Usage: goose shell-completions [OPTIONS] [[bash|zsh|fish]]

  Manage shell completions for goose

Options:
  --install   Install shell completions
  --generate  Generate shell completions
  --help      Show this message and exit.

Note: For bash and zsh, the user will need to source {rc_file} before it can take effect.

Alternatively, you can generate the completions and manually install run them yourself

goose shell-completions --generate bash > path/to/custom-bash
goose shell-completions --generate fish > path/to/completion.fish
goose shell-completions --generate zsh > path/to/custom-zsh

Example installations with autocompletion per $SHELL

image

Guard for exclusive options --generate or --install only

image

Autocomplete for session (via fish; goose session resume a<tab>)

image