diff --git a/completions/rmmod b/completions/rmmod index 3b266067..20d3bfce 100644 --- a/completions/rmmod +++ b/completions/rmmod @@ -6,6 +6,17 @@ _rmmod() local cur prev words cword _init_completion || return + case $prev in + -h|--help|-V|--version) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + _installed_modules "$cur" return 0 } && diff --git a/test/completion/rmmod.exp b/test/completion/rmmod.exp new file mode 100644 index 00000000..040c7372 --- /dev/null +++ b/test/completion/rmmod.exp @@ -0,0 +1 @@ +assert_source_completions rmmod diff --git a/test/lib/completions/rmmod.exp b/test/lib/completions/rmmod.exp new file mode 100644 index 00000000..6c563211 --- /dev/null +++ b/test/lib/completions/rmmod.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "rmmod -" +sync_after_int + + +teardown