diff --git a/CHANGES b/CHANGES index 5418c02a..f272503e 100644 --- a/CHANGES +++ b/CHANGES @@ -8,8 +8,8 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add compgen, crontab, iftop, lrzip, POSIX sh, xmodmap, and xrdb - completions. + * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, filefrag, + iftop, lrzip, POSIX sh, tune2fs, xmodmap, and xrdb completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/completions/Makefile.am b/completions/Makefile.am index ffd3fdee..f335b5d0 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -35,6 +35,7 @@ bashcomp_DATA = abook \ dpkg \ dselect \ dsniff \ + e2fsprogs \ findutils \ freeciv \ freerdp \ diff --git a/completions/e2fsprogs b/completions/e2fsprogs new file mode 100644 index 00000000..1a240f1b --- /dev/null +++ b/completions/e2fsprogs @@ -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 diff --git a/test/completion/badblocks.exp b/test/completion/badblocks.exp new file mode 100644 index 00000000..74bfcd5d --- /dev/null +++ b/test/completion/badblocks.exp @@ -0,0 +1 @@ +assert_source_completions badblocks diff --git a/test/completion/dumpe2fs.exp b/test/completion/dumpe2fs.exp new file mode 100644 index 00000000..22d1523c --- /dev/null +++ b/test/completion/dumpe2fs.exp @@ -0,0 +1 @@ +assert_source_completions dumpe2fs diff --git a/test/completion/e2freefrag.exp b/test/completion/e2freefrag.exp new file mode 100644 index 00000000..713ee236 --- /dev/null +++ b/test/completion/e2freefrag.exp @@ -0,0 +1 @@ +assert_source_completions e2freefrag diff --git a/test/completion/e2label.exp b/test/completion/e2label.exp new file mode 100644 index 00000000..2383c98e --- /dev/null +++ b/test/completion/e2label.exp @@ -0,0 +1 @@ +assert_source_completions e2label diff --git a/test/completion/filefrag.exp b/test/completion/filefrag.exp new file mode 100644 index 00000000..eeb5f8ce --- /dev/null +++ b/test/completion/filefrag.exp @@ -0,0 +1 @@ +assert_source_completions filefrag diff --git a/test/completion/tune2fs.exp b/test/completion/tune2fs.exp new file mode 100644 index 00000000..db034967 --- /dev/null +++ b/test/completion/tune2fs.exp @@ -0,0 +1 @@ +assert_source_completions tune2fs diff --git a/test/lib/completions/badblocks.exp b/test/lib/completions/badblocks.exp new file mode 100644 index 00000000..d453b5bd --- /dev/null +++ b/test/lib/completions/badblocks.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "badblocks " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dumpe2fs.exp b/test/lib/completions/dumpe2fs.exp new file mode 100644 index 00000000..e935c504 --- /dev/null +++ b/test/lib/completions/dumpe2fs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "dumpe2fs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/e2freefrag.exp b/test/lib/completions/e2freefrag.exp new file mode 100644 index 00000000..1530c9c9 --- /dev/null +++ b/test/lib/completions/e2freefrag.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "e2freefrag " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/e2label.exp b/test/lib/completions/e2label.exp new file mode 100644 index 00000000..8ae7f443 --- /dev/null +++ b/test/lib/completions/e2label.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "e2label " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/filefrag.exp b/test/lib/completions/filefrag.exp new file mode 100644 index 00000000..fa80cd05 --- /dev/null +++ b/test/lib/completions/filefrag.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "filefrag " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tune2fs.exp b/test/lib/completions/tune2fs.exp new file mode 100644 index 00000000..df70d904 --- /dev/null +++ b/test/lib/completions/tune2fs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "tune2fs " + + +sync_after_int + + +teardown