diff options
-rw-r--r-- | Makefile | 12 | ||||
l--------- | completion/bash-git.patch | 1 | ||||
-rwxr-xr-x | completion/make.sh | 12 | ||||
-rw-r--r-- | completion/zsh-git.patch | 50 |
4 files changed, 71 insertions, 4 deletions
@@ -21,8 +21,10 @@ DIST = \ Makefile \ pakku.conf \ completion/bash.patch \ + completion/bash-git.patch \ completion/make.sh \ completion/zsh.patch \ + completion/zsh-git.patch \ doc/asciidoc.conf \ ${MAN_PAGES:=.txt} \ lib/*.nim \ @@ -80,11 +82,17 @@ all: \ ${TARGETS} \ ${TARGETS_NODIST} -completion/bash: completion/make.sh completion/bash.patch +completion/bash: \ + completion/make.sh \ + completion/bash.patch \ + completion/bash-git.patch @echo "GEN: $@" @(cd completion && ./make.sh 'bash') -completion/zsh: completion/make.sh completion/zsh.patch +completion/zsh: \ + completion/make.sh \ + completion/zsh.patch \ + completion/zsh-git.patch @echo "GEN: $@" @(cd completion && ./make.sh 'zsh') diff --git a/completion/bash-git.patch b/completion/bash-git.patch new file mode 120000 index 0000000..7f0241d --- /dev/null +++ b/completion/bash-git.patch @@ -0,0 +1 @@ +bash.patch
\ No newline at end of file diff --git a/completion/make.sh b/completion/make.sh index 323dad6..b8f0d47 100755 --- a/completion/make.sh +++ b/completion/make.sh @@ -10,6 +10,14 @@ function error() { } function apply-patch() { + for f in "$@"; do + patch -sNp1 --dry-run -i "$f" > /dev/null && { + patch -sNp1 -r - --no-backup-if-mismatch -i "$f" + return "$?" + } + done + + # show error applying first patch patch -sNp1 -r - --no-backup-if-mismatch -i "$1" } @@ -30,7 +38,7 @@ function delete-shell-array() { > 'bash' || error 'bash' - apply-patch 'bash.patch' || + apply-patch 'bash.patch' 'bash-git.patch' || error 'bash' exit 0 @@ -51,7 +59,7 @@ function delete-shell-array() { > 'zsh' || error 'zsh' - apply-patch 'zsh.patch' || + apply-patch 'zsh.patch' 'zsh-git.patch' || error 'zsh' exit 0 diff --git a/completion/zsh-git.patch b/completion/zsh-git.patch new file mode 100644 index 0000000..adf7edd --- /dev/null +++ b/completion/zsh-git.patch @@ -0,0 +1,50 @@ +--- a/zsh ++++ b/zsh +@@ -1,1 +1,1 @@ +-#compdef pacman pacman.static=pacman pacman-key makepkg ++#compdef pakku +@@ -139,2 +139,6 @@ + '--print-format[Specify how the targets should be printed]' ++ {-n,--build}'[Build targets from source]' ++ '--keyserver[Keyserver to receive keys from]' ++ '--noaur[Disable all AUR operations]' ++ {-z,--source}'[Retrieve PKGBUILD source]' + ) +@@ -310,1 +314,6 @@ +- packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) ) ++ if [[ ${words[CURRENT]%/*} == 'aur' ]]; then ++ packages=( $(_call_program packages $cmd[@] -Ss ${words[CURRENT]#*/} | ++ grep -Po '(?<=^aur/)[^ ]+') ) ++ else ++ packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) ) ++ fi +@@ -314,1 +323,1 @@ +- packages=( $(_call_program packages $cmd[@] -Sql) ) ++ packages=( $(_call_program packages $cmd[@] -Ssq ${words[CURRENT]}) ) +@@ -318,1 +327,1 @@ +- repositories=($(pacman-conf --repo-list)) ++ repositories=($(pacman-conf --repo-list) aur) +@@ -361,1 +370,1 @@ +- cmd=( "pacman" "2>/dev/null") ++ cmd=("pakku" "2>/dev/null") +@@ -371,1 +380,1 @@ +-_pakku_zsh_comp() { ++_pakku_comp() { +@@ -501,17 +510,0 @@ +- +-_pakku_comp() { +- case "$service" in +- makepkg) +- _makepkg "$@" +- ;; +- pacman-key) +- _pakku_key "$@" +- ;; +- pacman) +- _pakku_zsh_comp "$@" +- ;; +- *) +- _message "Error" +- ;; +- esac +-} |