summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-05-27 21:50:17 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-05-27 21:50:17 +0300
commit346a97f0c7fd72a29a8c6507adf6fa2e25676ca4 (patch)
tree2cab3f867671cda48a73366aec495eaa300fffa8
parentMakefile: remove legacy dist rules (diff)
downloadgentoo-bashcomp-346a97f0c7fd72a29a8c6507adf6fa2e25676ca4.tar.gz
gentoo-bashcomp-346a97f0c7fd72a29a8c6507adf6fa2e25676ca4.tar.bz2
gentoo-bashcomp-346a97f0c7fd72a29a8c6507adf6fa2e25676ca4.zip
add completion for perl-cleaner from app-admin/perl-cleaner
Based on code from Michal Privoznik <michal.privoznik@gmail.com> Closes: https://github.com/gentoo-perl/perl-cleaner/pull/10 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--completions/perl-cleaner41
1 files changed, 41 insertions, 0 deletions
diff --git a/completions/perl-cleaner b/completions/perl-cleaner
new file mode 100644
index 0000000..a4cf9fd
--- /dev/null
+++ b/completions/perl-cleaner
@@ -0,0 +1,41 @@
+# Gentoo Linux Bash Shell Command Completion
+#
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+#
+# perl-cleaner completion (from app-admin/perl-cleaner)
+#
+
+_perl_cleaner() {
+ local i cur prev
+ _get_comp_words_by_ref cur prev
+
+ local OPTS=(
+ -h --help -V --version -p --pretend -v --verbose -q --quite
+ --modules --allmodules --libperl --all --reallyall
+ --dont-delete-leftovers -P --package-manager
+ )
+
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -- ]]; then
+ local root_command=emerge
+ _command_offset ${i}
+ return
+ fi
+ done
+
+ case ${prev} in
+ -P|--package-manager)
+ COMPREPLY=($(compgen -W 'portage pkgcore paludis' -- "${cur}"))
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "${cur}") )
+ return 0
+
+} &&
+complete -F _perl_cleaner perl-cleaner
+
+# vim: ft=sh:et:ts=4:sw=4:tw=80