aboutsummaryrefslogtreecommitdiff
path: root/completion/make.sh
blob: 51b07304d58b0a08af8b45d18939ec3e4f2aefa1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

pacman_bash_completion='/usr/share/bash-completion/completions/pacman'

function delete-shell-fn() {
  perl -0777 -pe 's/\n'"$1"'\(\) *\{\n([^}].*\n)*\}\n*/\n\n/g;s/\n{3,}/\n\n/g'
}

cat "$pacman_bash_completion" |
delete-shell-fn '_pacman_keyids' |
delete-shell-fn '_pacman_key' |
delete-shell-fn '_makepkg' |
sed 's/^_pacman() {$/_pakku() {/' \
> 'bash' || {
  rm 'bash'
  exit 1
}
patch -sNp1 -r - --no-backup-if-mismatch -i 'bash.patch' || {
  rm 'bash'
  exit 1
}