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

fix « cabal »'s bash-completion #5927

Open
sboosali opened this issue Mar 8, 2019 · 1 comment
Open

fix « cabal »'s bash-completion #5927

sboosali opened this issue Mar 8, 2019 · 1 comment

Comments

@sboosali
Copy link
Collaborator

sboosali commented Mar 8, 2019

  • ran shellcheck (a bash linter) on ./
  • add shopt -s nullglob to _cabal_list_targets
  1. lint with shellcheck:
$ shellcheck ./cabal/cabal-install/bash-completion/cabal

^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.


In cabal line 108:
    cmd=( ${COMP_WORDS[@]} )
          ^--------------^ SC2206: Quote to prevent word splitting, or split robustly with mapfile or read -a.


In cabal line 114:
    COMPREPLY=( $( compgen -W "$( eval "${cmd[@]}" 2>/dev/null ) $( _cabal_targets "${cmd[@]}" ) $( _cabal_subcommands "${COMP_WORDS[@]}" )" -- "$cur" ) )
                ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).

For more information:
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2206 -- Quote to prevent word splitting, ...
  https://www.shellcheck.net/wiki/SC2207 -- Prefer mapfile or read -a to spli...
  1. silence warnings:

e.g.:

$ cabal new-build<TAB>

$ cabal new-build grep: ./*.cabal: No such file or directory

without nullglob, if a glob-pattern fails, it becomes a literal (i.e. the string with an asterix, rather than an empty string; e.g. is "./*.cabal", should be "")
).

this is important because cabal.project both supports and encourages a "megarepo" style where packages are in subdirectories.

sboosali added a commit to sboosali/cabal that referenced this issue Mar 8, 2019
* ran `shellcheck` (a bash linter) on `./`
* add `shopt -s nullglob` to `_cabal_list_targets`
23Skidoo added a commit that referenced this issue Mar 10, 2019
fix « cabal »'s bash-completion (see issue #5927)
@sboosali
Copy link
Collaborator Author

sboosali commented May 1, 2019

cleanup commit: #6023

(just wanted to get this in before the 3.0 release)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants