Add/improve various autotools completions.

This commit is contained in:
Ville Skyttä 2010-11-12 21:56:40 +02:00
parent 4162edf2c1
commit 8f0055553b
15 changed files with 313 additions and 1 deletions

View File

@ -36,6 +36,7 @@ bash-completion (2.x)
* Improve relevance of many user/group completions, depending on context.
* Remove most "-o filenames" options to "complete", turn "-o filenames" on
dynamically when needed instead.
* Add/improve various autotools completions.
[ Freddy Vulto ]
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)

View File

@ -1575,7 +1575,7 @@ _longopt()
fi
}
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps autoconf automake awk bash bc bison cat colordiff cp csplit \
for i in a2ps awk bash bc bison cat colordiff cp csplit \
curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \

View File

@ -6,6 +6,8 @@ bashcomp_DATA = abook \
apt-build \
aptitude \
aspell \
autoconf \
automake \
autorpm \
bash-builtins \
bind-utils \

124
completions/autoconf Normal file
View File

@ -0,0 +1,124 @@
# Completions for autoconf tools
have autoconf &&
_autoconf()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|-h|--version|-V|--trace|-t)
return 0
;;
--output|-o)
_filedir
return 0
;;
--warnings|-W)
local cats=( cross obsolete syntax )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
--prepend-include|-B|--include|-I)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return
fi
_filedir '@(ac|in)'
} &&
complete -F _autoconf autoconf
have autoreconf || have autoheader &&
_autoreconf()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|-h|--version|-V)
return 0
;;
--warnings|-W)
local cats=( cross gnu obsolete override portability syntax \
unsupported )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
--prepend-include|-B|--include|-I)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return 0
fi
if [[ $1 == autoheader ]] ; then
_filedir '@(ac|in)'
else
_filedir -d
fi
} &&
complete -F _autoreconf autoreconf autoheader
have autoscan || have autoupdate &&
_autoscan()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|-h|--version|-V)
return 0
;;
--prepend-include|-B|--include|-I)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return 0
fi
if [[ $1 == autoupdate ]] ; then
_filedir '@(ac|in)'
else
_filedir -d
fi
} &&
complete -F _autoscan autoscan autoupdate
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

80
completions/automake Normal file
View File

@ -0,0 +1,80 @@
# Completions for automake tools
have automake &&
_automake()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|--version)
return 0
;;
--warnings|-W)
local cats=( gnu obsolete override portability syntax unsupported )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
--libdir)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return
fi
_filedir
} &&
complete -F _automake automake automake-1.11
have aclocal &&
_aclocal()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|--print-ac-dir|--version)
return 0
;;
--acdir|-I)
_filedir -d
return 0
;;
--output)
_filedir
return 0
;;
--warnings|-W)
local cats=( syntax unsupported )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
esac
$split && return 0
_longopt $1
} &&
complete -F _aclocal aclocal aclocal-1.11
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -0,0 +1 @@
assert_source_completions aclocal

View File

@ -0,0 +1 @@
assert_source_completions autoheader

View File

@ -0,0 +1 @@
assert_source_completions autoreconf

View File

@ -0,0 +1 @@
assert_source_completions autoscan

View File

@ -0,0 +1 @@
assert_source_completions autoupdate

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "aclocal "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "autoheader "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "autoreconf "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "autoscan "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "autoupdate "
sync_after_int
teardown