Add badblocks, dumpe2fs, e2freefrag, e2label, filefrag, and tune2fs completions.

This commit is contained in:
Ville Skyttä 2010-09-19 14:33:09 +03:00
parent b822b7cceb
commit 0ed0de3047
15 changed files with 308 additions and 2 deletions

View File

@ -8,8 +8,8 @@ bash-completion (2.x)
[ Ville Skyttä ] [ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3. * Activate hping2 completion also for hping and hping3.
* Add compgen, crontab, iftop, lrzip, POSIX sh, xmodmap, and xrdb * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, filefrag,
completions. iftop, lrzip, POSIX sh, tune2fs, xmodmap, and xrdb completions.
* Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer
filename completions. filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions. * Add "short" tarball extensions to unxz, unlzma etc completions.

View File

@ -35,6 +35,7 @@ bashcomp_DATA = abook \
dpkg \ dpkg \
dselect \ dselect \
dsniff \ dsniff \
e2fsprogs \
findutils \ findutils \
freeciv \ freeciv \
freerdp \ freerdp \

179
completions/e2fsprogs Normal file
View File

@ -0,0 +1,179 @@
# bash completion for e2fsprogs
have badblocks &&
_badblocks()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-b|-c|-e|-d|-p|-t)
return 0
;;
-i|-o)
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
# -w (dangerous) and -X (internal use) not here on purpose
COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \
-- "$cur" ) )
return 0
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _badblocks -o filenames badblocks
have dumpe2fs &&
_dumpe2fs()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-o|-V)
return 0
;;
-i)
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) )
return 0
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _dumpe2fs -o filenames dumpe2fs
have e2freefrag &&
_e2freefrag()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-c|-h)
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -h' -- "$cur" ) )
return 0
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _e2freefrag -o filenames e2freefrag
have e2label &&
_e2label()
{
COMPREPLY=()
local cur cword
_get_comp_words_by_ref cur cword
if [ $cword -eq 1 ]; then
cur=${cur:=/dev/}
_filedir
fi
} &&
complete -F _e2label -o filenames e2label
have filefrag &&
_filefrag()
{
COMPREPLY=()
local cur
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) )
return 0
fi
_filedir
} &&
complete -F _filefrag -o filenames filefrag
have tune2fs &&
_tune2fs()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-c|-C|-E|-i|-J|-L|-m|-r|-T)
return 0
;;
-e)
COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) )
return 0
;;
-g)
_gids
COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
;;
-M)
_filedir -d
;;
-o)
local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16
^journal_data ^journal_data_ordered ^journal_data_writeback)
COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
return 0
;;
-O)
local -a opts=(^dir_index ^filetype ^flex_bg ^has_journal
^large_file ^resize_inode ^sparse_super ^uninit_bg)
COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
return 0
;;
-u)
_uids
COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
;;
-U)
COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o
-O -r -T -u -U' -- "$cur" ) )
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _tune2fs -o filenames tune2fs
# 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 badblocks

View File

@ -0,0 +1 @@
assert_source_completions dumpe2fs

View File

@ -0,0 +1 @@
assert_source_completions e2freefrag

View File

@ -0,0 +1 @@
assert_source_completions e2label

View File

@ -0,0 +1 @@
assert_source_completions filefrag

View File

@ -0,0 +1 @@
assert_source_completions tune2fs

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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