Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/05e0dc6260b79d13f00a8db63d3b2edcc21cbbdd >--------------------------------------------------------------- commit 05e0dc6260b79d13f00a8db63d3b2edcc21cbbdd Author: Lennart Kolmodin <[email protected]> Date: Wed Dec 19 21:57:47 2007 +0000 Initial attempt at command line completion >--------------------------------------------------------------- cabal-install/bash-completion/cabal | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/cabal-install/bash-completion/cabal b/cabal-install/bash-completion/cabal new file mode 100644 index 0000000..0beccee --- /dev/null +++ b/cabal-install/bash-completion/cabal @@ -0,0 +1,30 @@ +# cabal command line completion +# Copyright 2007 "Lennart Kolmodin" <[email protected]> +# "Duncan Coutts" <[email protected]> +# + +_cabal() +{ + # get the word currently being completed + local cur + cur=${COMP_WORDS[$COMP_CWORD]} + + # create a command line to run + local cmd + # copy all words the user has entered + cmd=( ${COMP_WORDS[@]} ) + + # replace the current word with --list-options + cmd[${COMP_CWORD}]="--list-options" + + # TODO: add completion of packages + # we want cabal support for this to make it fast + # $ time cabal list | cut -d' ' -f1 + # real 0m2.454s + # on a Intel Core 2 Duo 1.6 GHz, too slow + + # the resulting completions should be put into this array + COMPREPLY=( $( compgen -W "$( ${cmd[@]} )" -- $cur ) ) +} + +complete -F _cabal -o default cabal _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
