Skip to content

Commit 6779834

Browse files
committed
fix: Properly show local packages in list command
1 parent 870d5cd commit 6779834

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

pkg/lib/commands/do-list.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ do-list() {
3636
for package_path in "$BPM_PACKAGES_PATH"/*/*/*; do
3737
util.extract_data_from_package_dir "$package_path"
3838
local site="$REPLY1"
39-
local package="$REPLY2/$REPLY3"
39+
local user="$REPLY2"
40+
local repository="$REPLY3"
41+
local package="$user/$repository"
4042

4143
# Users that have installed packages before the switch to namespacing by
4244
# site domain name will print incorrectly. So, we check to make sure the site
@@ -46,7 +48,11 @@ do-list() {
4648
continue
4749
fi
4850

49-
printf "%s\n" "$site/$package"
51+
if [ "$site" = 'local' ]; then
52+
printf "%s\n" "$site/$user"
53+
else
54+
printf "%s\n" "$site/$package"
55+
fi
5056
done
5157
fi
5258

tests/do-list.bats

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ load 'util/init.sh'
2828
assert_output ""
2929
}
3030

31+
@test "properly list for local packages" {
32+
local site='github.com'
33+
local pkg='somepath/project2'
34+
35+
test_util.mock_command do-plumbing-add-deps
36+
test_util.mock_command do-plumbing-link-bins
37+
test_util.mock_command do-plumbing-link-completions
38+
test_util.mock_command do-plumbing-link-man
39+
40+
test_util.create_package "$pkg"
41+
do-link "$BPM_ORIGIN_DIR/$site/$pkg"
42+
43+
run do-list
44+
45+
assert_success
46+
assert_output "local/project2"
47+
}
48+
3149
@test "properly list outdated packages" {
3250
local site="github.com"
3351
local pkg1='username/outdated'

0 commit comments

Comments
 (0)