File tree Expand file tree Collapse file tree 7 files changed +60
-34
lines changed Expand file tree Collapse file tree 7 files changed +60
-34
lines changed Original file line number Diff line number Diff line change @@ -37,52 +37,42 @@ main() {
37
37
complete)
38
38
shift
39
39
do-complete " $@ "
40
- exit
41
40
;;
42
41
echo)
43
42
shift
44
43
do-echo " $@ "
45
- exit
46
44
;;
47
45
init)
48
46
shift
49
47
do-init " $@ "
50
- exit
51
48
;;
52
49
install)
53
50
shift
54
51
do-install " $@ "
55
- exit
56
52
;;
57
53
link)
58
54
shift
59
55
do-link " $@ "
60
- exit
61
56
;;
62
57
list)
63
58
shift
64
59
do-list " $@ "
65
- exit
66
60
;;
67
61
outdated)
68
62
shift
69
63
bpm-outdated " $@ "
70
- exit
71
64
;;
72
65
package-path)
73
66
shift
74
67
bpm-package-path " $@ "
75
- exit
76
68
;;
77
69
uninstall)
78
70
shift
79
71
do-uninstall " $@ "
80
- exit
81
72
;;
82
73
upgrade)
83
74
shift
84
75
do-upgrade " $@ "
85
- exit
86
76
;;
87
77
* )
88
78
if [ -n " $1 " ]; then
Original file line number Diff line number Diff line change 3
3
do-install () {
4
4
local with_ssh=' no'
5
5
6
- case " $1 " in
6
+ local -a pkgs=()
7
+ for arg; do
8
+ case " $arg " in
7
9
--ssh)
8
10
with_ssh=' yes'
9
- shift
10
- ;;
11
- esac
11
+ ;;
12
+ * )
13
+ pkgs+=(" $arg " )
14
+ ;;
15
+ esac
16
+ done
12
17
13
- if (( $# == 0 )) ; then
18
+ if (( ${ # pkgs[@]} == 0 )) ; then
14
19
die " At least one package must be supplied"
15
20
fi
16
21
17
- for repoSpec; do
22
+ for repoSpec in " ${pkgs[@]} " ; do
18
23
util.construct_clone_url " $repoSpec " " $with_ssh "
19
24
local uri=" $REPLY1 "
20
25
local package=" $REPLY2 "
Original file line number Diff line number Diff line change 1
1
# shellcheck shell=bash
2
2
3
3
do-link () {
4
- if (( $# == 0 )) ; then
5
- die " You must supply at least one directory"
6
- fi
7
-
8
4
local install_deps=' yes'
9
5
10
- case " $1 " in
11
- --no-deps)
12
- install_deps=' no'
13
- shift
14
- ;;
15
- esac
6
+ local -a dirs=()
7
+ for arg; do
8
+ case " $arg " in
9
+ --no-deps)
10
+ install_deps=' no'
11
+ ;;
12
+ * )
13
+ dirs+=(" $arg " )
14
+ ;;
15
+ esac
16
+ done
17
+
18
+ if (( ${# dirs[@]} == 0 )) ; then
19
+ die " You must supply at least one directory"
20
+ fi
16
21
17
- for directory; do
22
+ for directory in " ${dirs[@]} " ; do
18
23
if [ ! -d " $directory " ]; then
19
24
die " Directory '$directory ' not found"
20
25
fi
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ do-list() {
7
7
case " $arg " in
8
8
--outdated)
9
9
should_show_outdated=' yes'
10
- shift
11
10
;;
12
11
esac
13
12
done
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ util.construct_clone_url() {
83
83
site=" github.com"
84
84
package=" $repoSpec "
85
85
else
86
- die " Invalid repository"
86
+ die " Invalid repository ' $repoSpec ' "
87
87
fi
88
88
89
89
if [[ " $package " = * @* ]]; then
@@ -234,13 +234,13 @@ Subcommands:
234
234
init <shell>
235
235
Configure shell environment for Basher
236
236
237
- install [--ssh] [site]/ <package>[@ref]
237
+ install [--ssh] [[ site/] <package>[@ref]... ]
238
238
Installs a package from GitHub (or a custom site)
239
239
240
- uninstall <package>
240
+ uninstall <package... >
241
241
Uninstalls a package
242
242
243
- link [--no-deps] <directory>
243
+ link [--no-deps] <directory... >
244
244
Installs a local directory as a bpm package. These show up with
245
245
a namespace of 'bpm-local'
246
246
@@ -250,10 +250,10 @@ Subcommands:
250
250
package-path <package>
251
251
Outputs the path for a package
252
252
253
- upgrade <package>
253
+ upgrade <package... >
254
254
Upgrades a package
255
255
256
- complete <command>
256
+ complete <command... >
257
257
Perform the completion for a particular subcommand. Used by the completion scripts
258
258
259
259
Examples:
Original file line number Diff line number Diff line change @@ -123,6 +123,19 @@ load 'util/init.sh'
123
123
assert_line " do-plumbing-clone git@github.com:username/package.git username/package"
124
124
}
125
125
126
+ @test " uses ssh protocol, when specified (at end)" {
127
+ test_util.mock_command do-plumbing-clone
128
+ test_util.mock_command do-plumbing-add-deps
129
+ test_util.mock_command do-plumbing-link-bins
130
+ test_util.mock_command do-plumbing-link-completions
131
+ test_util.mock_command do-plumbing-link-man
132
+
133
+ run do-install username/package --ssh
134
+
135
+ assert_success
136
+ assert_line " do-plumbing-clone git@github.com:username/package.git username/package"
137
+ }
138
+
126
139
@test " uses ssh protocol raw, when specified" {
127
140
test_util.mock_command do-plumbing-clone
128
141
test_util.mock_command do-plumbing-add-deps
Original file line number Diff line number Diff line change @@ -139,6 +139,20 @@ load 'util/init.sh'
139
139
refute_line " do-plumbing-add-deps bpm-local/package2"
140
140
}
141
141
142
+ @test " respects the --no-deps option (at end)" {
143
+ test_util.mock_command do-plumbing-add-deps
144
+ test_util.mock_command do-plumbing-link-bins
145
+ test_util.mock_command do-plumbing-link-completions
146
+ test_util.mock_command do-plumbing-link-man
147
+
148
+ mkdir ' package2'
149
+
150
+ run do-link ' package2' --no-deps
151
+
152
+ assert_success
153
+ refute_line " do-plumbing-add-deps bpm-local/package2"
154
+ }
155
+
142
156
@test " links the current directory" {
143
157
test_util.mock_command do-plumbing-add-deps
144
158
test_util.mock_command do-plumbing-link-bins
You can’t perform that action at this time.
0 commit comments