$ 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...
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.
shellcheck
(a bash linter) on./
shopt -s nullglob
to_cabal_list_targets
e.g.:
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.