Skip to content

Instantly share code, notes, and snippets.

@mossprescott
Created December 11, 2018 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mossprescott/df08acd3c603fcf4ca64f05943b17d25 to your computer and use it in GitHub Desktop.
Save mossprescott/df08acd3c603fcf4ca64f05943b17d25 to your computer and use it in GitHub Desktop.
Dumb bash completion for stack
_stack()
{
local cur prev opts pkgs
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="build test --no-run-tests --test-arguments --ghc-options"
pkgs=$(find . -name package.yaml -and -not -path '*/.stack-work/*' | xargs -n 1 dirname | xargs -n 1 basename)
COMPREPLY=( $(compgen -W "$opts $pkgs" -- ${cur}) )
return 0
}
complete -F _stack stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment