Files
haikuports/app-shells/bash_completion/patches/bash_completion-haiku.patch

103 lines
2.4 KiB
Diff

From 305b56f2c4e91c8502c253e4cfb2d83f46678dda Mon Sep 17 00:00:00 2001
From: Kostadin Damyanov <maxmight@gmail.com>
Date: Wed, 23 Sep 2015 22:55:52 +0300
Subject: [PATCH] Add pkgman and finddir support.
---
completions/Makefile.am | 4 +++-
completions/finddir | 17 +++++++++++++++++
completions/pkgman | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 completions/finddir
create mode 100644 completions/pkgman
diff --git a/completions/Makefile.am b/completions/Makefile.am
index f312b3a..3c43796 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -377,7 +377,9 @@ bashcomp_DATA = a2x \
xz \
xzdec \
ypmatch \
- yum-arch
+ yum-arch \
+ pkgman \
+ finddir
EXTRA_DIST = $(bashcomp_DATA) \
_mock _modules _subversion _udevadm _yum _yum-utils
diff --git a/completions/finddir b/completions/finddir
new file mode 100644
index 0000000..cf7f6e4
--- /dev/null
+++ b/completions/finddir
@@ -0,0 +1,17 @@
+_finddir()
+{
+ local cur words
+ _init_completion || return
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l -v' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W '$( finddir -l )' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _finddir finddir
diff --git a/completions/pkgman b/completions/pkgman
new file mode 100644
index 0000000..f1f942f
--- /dev/null
+++ b/completions/pkgman
@@ -0,0 +1,42 @@
+_pkgman()
+{
+ local cur words
+ _init_completion || return
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ local special i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == @(install|uninstall) ]]; then
+ special=${words[i]}
+ fi
+ done
+
+ if [[ -n $special ]]; then
+ case $special in
+ install)
+ COMPREPLY=( $( compgen -W "$( pkgman search -a -D | awk 'NR>2 { print $2 }' )" -- "$cur" ) )
+ return 0
+ ;;
+ uninstall)
+ COMPREPLY=( $( compgen -W "$( pkgman search -a -i | awk 'NR>2 { print $2 }' )" -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+ fi
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'full-sync install search \
+ uninstall update add-repo drop-repo list-repos refresh \
+ resolve-dependencies' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _pkgman pkgman
--
2.2.2