koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36k stars 1.76k forks source link

Bash tab-completion for shellcheck #309

Open gwern opened 9 years ago

gwern commented 9 years ago

As a shell-oriented tool, it would be nice if shellcheck automatically provided tab-completion which focused on .sh or shell-related files. A good list (sourced from sh/bash/zsh man pages) would be:

*.sh
*.bash
*.ksh
*.zsh
.bash_logout
.bash_profile
.bashrc
.env
.inputrc
.profile
.zlogin
.zlogout
.zprofile
.zshenv
.zshrc
bash.bash.logout
bash.bashrc
profile
zlogin
zlogout
zprofile
zshenv
zshrc

If any files match these, they should be prioritized by the tab-completion over other files with the same prefix (ie "arbtt-classify.sh" should match 'shellcheck a\t' before matching "arbtt-classified.txt", since it's much less likely that the text file is the one I want to run shellcheck on).

koalaman commented 9 years ago

Completion is controlled by the shell and not the executable. If anyone wants to contribute to e.g. the bash-completion project, this is up for grabs.

izabera commented 9 years ago

@gwern have a look at this: https://gist.github.com/izabera/3c52c084937533cf82ce it's a bash function that completes shellcheck's options, and only files that end in .sh or similar, or that have a shebang like #!/bin/bash or similar.