Skip to content
Snippets Groups Projects
Commit bc787c89 authored by Christian Engwer's avatar Christian Engwer
Browse files

implement tab completion for dunecontrol

we install dune.complete into $PREFIX/share/bash-complete/
upto now you have to source the file by hand.
parent 5b55b766
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,8 @@ AC_CONFIG_FILES([Makefile
doc/buildsystem/Makefile
m4/Makefile
am/Makefile
share/Makefile
share/bash-completion/Makefile
dune-common.pc])
# make scripts executable
AC_CONFIG_FILES([
......
add_subdirectory("bash-completion")
# $Id$
SUBDIRS = bash-completion
# include further rules needed by Dune
include $(top_srcdir)/am/global-rules
install(FILES
dune.complete
DESTINATION ${CMAKE_INSTALL_DATADIR}/share/bash-completion/
)
# $Id$
am_DATA = dune.complete
# Not all file names seem to be treated equal by _DATA.
# inkscape.am no-check-without-lib have to be listed in
# EXTRA_DIST to be included into the tarball.
EXTRA_DIST = CMakeLists.txt
completedir = $(datarootdir)/bash-completion/
include $(top_srcdir)/am/global-rules
# -*- shell-script -*-
# bash completion for dunecontrol
_dunecontrol_complete ()
{
local COMMANDS="printdeps vcsetup update autogen configure make all exec bexec status svn git"
local COMMAND_OPTS="$(for i in printdeps vcsetup update autogen configure make all exec bexec status svn git; do echo --$i-opts; done)"
# per default we offer the list of all core modules and the advertised discretization modules
local MODULES="dune-common dune-grid dune-grid-howto dune-istl dune-geometry dune-localfunctions dune-pdelab dune-fem dune-fufem"
if test "x$DUNE_MODULES" != x; then
MODULES=$DUNE_MODULES
fi
# get cimpletion information
local cur prev words cword split
_init_completion -s || return
# check wether we already have seen a command
local have_command=0
for i in `seq $COMP_CWORD`; do
case ${COMP_WORDS[i]} in
printdeps|vcsetup|update|autogen|configure|make|all|exec|bexec|status|svn|git)
have_command=1
;;
esac
done
# some options influence the next completion step
case $prev in
:)
COMPREPLY=( $(compgen -W "
$COMMANDS
" -- $cur) )
return 0
;;
-h|--help)
return 0
;;
--module)
COMPREPLY=( $(compgen -W " $MODULES " -- $cur ) )
compopt -o nospace
return 0
;;
--only)
COMPREPLY=( $(compgen -W " $MODULES " -- $cur ) )
compopt -o nospace
return 0
;;
--opts)
compopt -o filenames
COMPREPLY=( $( compgen -f -- "$cur" ) \
$( compgen -d -- "$cur" ) )
return 0
;;
# git)
# exec __git_func_wrap __git_main
# compopt -D
# COMPREPLY=( $( compgen -W ":" -- $cur ) )
# return 0
# ;;
esac
# if we already have a command, we either pass an options to the command,
# or we add a colon for the next command
if test x$have_command = x1; then
COMPREPLY=( $(compgen -W " -- : " -- $cur ) )
return 0;
fi
# the usual dunecontrol options
COMPREPLY=( $(compgen -W "
-h --help --use-cmake --current --resume --skipfirst
--module= --only=
--opts=
--builddir=
$COMMANDS
$COMMAND_OPTS
" -- $cur)
)
# don't append space to options --foo=...
[[ $COMPREPLY == *= ]] && compopt -o nospace
}
_dune_complete_init () {
# complete -F _duneproject_complete duneproject
complete -F _dunecontrol_complete dunecontrol
}
_dune_complete_init
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment