Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Shell completion #6842

Open
JamesKyburz opened this issue Mar 15, 2024 · 3 comments
Open

feat: Shell completion #6842

JamesKyburz opened this issue Mar 15, 2024 · 3 comments
Labels
type/feature Feature request

Comments

@JamesKyburz
Copy link

Support shell completion?

click has support for completion documented here

Is there any reason we shouldn't support it?

Proposal

Was thinking something along the lines of adding the allowing the following in ~/.zshrc, or ~/.bashrc

source <(sam completion)

Where we would detect if the completion is for zsh or bash, and error if the shell is unsupported.

@JamesKyburz JamesKyburz added stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/feature Feature request labels Mar 15, 2024
@sidhujus
Copy link
Contributor

Hi @JamesKyburz thanks for the feature request! I'll bring this up with the team.

@sidhujus sidhujus removed the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Mar 15, 2024
@super132
Copy link

As an alternative, you could try using Code Whisperer CLI and it gives smart auto-completion for SAM CLI commands.

@neilramsay
Copy link

As an optimisation to prevent shells having to generate completions each startup, I recommend a change to the proposal for bash:

#! /bin/bash
sam completion > ${XDG_DATA_HOME:-~/.local/share}/bash-completion/completions/sam

This is based off the bash-completion documentation:

Q. Where should I install my own local completions?

A. Put them in the completions subdir of $BASH_COMPLETION_USER_DIR (defaults to $XDG_DATA_HOME/bash-completion or ~/.local/share/bash-completion if $XDG_DATA_HOME is not set) to have them loaded automatically on demand when the respective command is being completed. See also the next question's answer for considerations for these files' names, they apply here as well. Alternatively, you can write them directly in ~/.bash_completion which is loaded eagerly by our main script.

Someone more familiar with zsh will need to provide guidance their completion system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Feature request
Projects
None yet
Development

No branches or pull requests

4 participants