File tree Expand file tree Collapse file tree 5 files changed +31
-16
lines changed Expand file tree Collapse file tree 5 files changed +31
-16
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,9 @@ do-list() {
34
34
done
35
35
else
36
36
for package_path in " $BPM_PACKAGES_PATH " /* /* /* ; do
37
- local site=" ${package_path%/* } " ; site=" ${site%/* } " ; site=" ${site##*/ } "
38
- local user=" ${package_path%/* } " ; user=" ${user##*/ } "
39
- local repository=" ${package_path##*/ } "
40
- local package=" $user /$repository "
37
+ util.extract_data_from_package_dir " $package_path "
38
+ local site=" $REPLY1 "
39
+ local package=" $REPLY2 /$REPLY3 "
41
40
42
41
# Users that have installed packages before the switch to namespacing by
43
42
# site domain name will print incorrectly. So, we check to make sure the site
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ do-plumbing-clone() {
6
6
local ref=" $3 "
7
7
8
8
ensure.non_zero ' uri' " $uri "
9
- # TODO: ensure.non_zero 'id'
9
+ ensure.non_zero ' id' " $id "
10
10
11
11
if [ -e " $BPM_PACKAGES_PATH /$id " ]; then
12
12
die " Package '$id ' is already present"
Original file line number Diff line number Diff line change @@ -9,22 +9,19 @@ do-remove() {
9
9
# If is local directory
10
10
# TODO: do this for upgrade as well
11
11
if [ -d " $repoSpec " ]; then
12
- local fullPath =
13
- fullPath =" $( util.readlink " $repoSpec " ) "
14
- fullPath =" ${fullPath %/ } "
12
+ local dir =
13
+ dir =" $( util.readlink " $repoSpec " ) "
14
+ dir =" ${dir %/ } "
15
15
16
- # TODO: make this a funcion, share it with do-list
17
- local site=" ${fullPath%/* } " ; site=" ${site%/* } " ; site=" ${site##*/ } "
18
- local user=" ${fullPath%/* } " ; user=" ${user##*/ } "
19
- local repository=" ${fullPath##*/ } "
20
- local package=" $user /$repository "
16
+ util.extract_data_from_package_dir " $dir "
17
+ local site=" $REPLY1 "
18
+ local package=" $REPLY2 /$REPLY3 "
21
19
22
- if [ " $fullPath " = " $BPM_PACKAGES_PATH /$site /$package " ]; then
20
+ if [ " $dir " = " $BPM_PACKAGES_PATH /$site /$package " ]; then
23
21
do_actual_removal " $site /$package "
24
22
fi
25
23
else
26
24
util.construct_clone_url " $repoSpec "
27
- local uri=" $REPLY1 "
28
25
local site=" $REPLY2 "
29
26
local package=" $REPLY3 "
30
27
local ref=" $REPLY4 "
Original file line number Diff line number Diff line change @@ -104,7 +104,6 @@ abstract.completions_do_action_zsh() {
104
104
local file=" $2 "
105
105
106
106
if grep -qs " ^#compdef" " $file " ; then
107
- # TODO: run mkdir outside of loop
108
107
case " $action " in
109
108
link)
110
109
mkdir -p " $BPM_INSTALL_COMPLETIONS /zsh/compsys"
Original file line number Diff line number Diff line change @@ -104,6 +104,26 @@ util.construct_clone_url() {
104
104
fi
105
105
}
106
106
107
+ # @description Given a path to a package directory, this extracts
108
+ # data like the site it was cloned from, the owner of
109
+ # the repository, and the name of the repository
110
+ util.extract_data_from_package_dir () {
111
+ REPLY1=
112
+ REPLY2=
113
+ REPLY3=
114
+
115
+ local dir=" $1 "
116
+ ensure.non_zero ' dir' " $dir "
117
+
118
+ local site=" ${dir%/* } " ; site=" ${site%/* } " ; site=" ${site##*/ } "
119
+ local user=" ${dir%/* } " ; user=" ${user##*/ } "
120
+ local repository=" ${dir##*/ } "
121
+
122
+ REPLY1=" $site "
123
+ REPLY2=" $user "
124
+ REPLY3=" $repository "
125
+ }
126
+
107
127
util.readlink () {
108
128
if command -v realpath & > /dev/null; then
109
129
realpath " $1 "
You can’t perform that action at this time.
0 commit comments