|
1 | 1 | # shellcheck shell=bash
|
2 | 2 |
|
| 3 | +do-actual-uninstall() { |
| 4 | + local package="$1" |
| 5 | + |
| 6 | + log.info "Uninstalling '$package'" |
| 7 | + do-plumbing-unlink-man "$package" |
| 8 | + do-plumbing-unlink-bins "$package" |
| 9 | + do-plumbing-unlink-completions "$package" |
| 10 | + |
| 11 | + rm -rf "${BPM_PACKAGES_PATH:?}/$package" |
| 12 | +} |
3 | 13 | do-uninstall() {
|
4 | 14 | if (( $# == 0 )); then
|
5 | 15 | die "You must supply at least one package"
|
6 | 16 | fi
|
7 | 17 |
|
8 | 18 | for repoSpec; do
|
9 |
| - local site= user= repository= ref= |
10 |
| - util.parse_package_full "$repoSpec" |
11 |
| - IFS=':' read -r site user repository ref <<< "$REPLY" |
| 19 | + if [ -d "$repoSpec" ]; then |
| 20 | + local fullPath= |
| 21 | + fullPath="$(util.readlink "$repoSpec")" |
| 22 | + fullPath="${fullPath%/}" |
12 | 23 |
|
13 |
| - local package="$user/$repository" |
| 24 | + local user="${fullPath%/*}"; user="${user##*/}" |
| 25 | + local repository="${fullPath##*/}" |
| 26 | + if [ "$fullPath" == "$BPM_PACKAGES_PATH/$user/$repository" ]; then |
| 27 | + do-actual-uninstall "$user/$repository" |
| 28 | + fi |
| 29 | + else |
| 30 | + local site= user= repository= ref= |
| 31 | + util.parse_package_full "$repoSpec" |
| 32 | + IFS=':' read -r site user repository ref <<< "$REPLY" |
14 | 33 |
|
15 |
| - if [ ! -e "$BPM_PACKAGES_PATH/$package" ]; then |
16 |
| - die "Package '$package' is not installed" |
17 |
| - fi |
18 |
| - |
19 |
| - log.info "Uninstalling '$repoSpec'" |
20 |
| - do-plumbing-unlink-man "$package" |
21 |
| - do-plumbing-unlink-bins "$package" |
22 |
| - do-plumbing-unlink-completions "$package" |
| 34 | + if [ ! -e "$BPM_PACKAGES_PATH/$user/$repository" ]; then |
| 35 | + die "Package '$user/$repository' is not installed" |
| 36 | + fi |
23 | 37 |
|
24 |
| - rm -rf "${BPM_PACKAGES_PATH:?}/$package" |
| 38 | + do-actual-uninstall "$user/$repository" |
| 39 | + fi |
25 | 40 | done
|
26 | 41 | }
|
0 commit comments