Skip to content

Commit 4b31903

Browse files
committed
fix: Automatically source 'bpm-load' within 'bpm init'
1 parent a9d78d9 commit 4b31903

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

docs/tutorials/bpm-load.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# bpm-load
2+
3+
The `bpm-load` is available for `Bash` and `Zsh` environments

pkg/lib/commands/do-init.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ echo_bpm_package_path_posix() {
2929
EOF
3030
}
3131

32+
echo_bpm_source_bpm_load() {
33+
cat <<-"EOF"
34+
# bpm-load
35+
source 'bpm-load'
36+
37+
EOF
38+
}
39+
3240
# For each shell, items are printed in order
3341
# - Setting bpm variables
3442
# - Sourcing bpm completion
@@ -86,6 +94,7 @@ do-init() {
8694
8795
EOF
8896
echo_bpm_include_posix
97+
echo_bpm_source_bpm_load
8998

9099
echo_bpm_package_path_posix
91100
cat <<-"EOF"
@@ -107,6 +116,7 @@ do-init() {
107116
EOF
108117

109118
echo_bpm_include_posix
119+
echo_bpm_source_bpm_load
110120

111121
echo_bpm_package_path_posix
112122
cat <<-"EOF"

tests/do-init.bats

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,26 @@ load './util/init.sh'
2020
assert test_util.is_exported 'BPM_CELLAR'
2121
}
2222

23-
@test "errors if shell is not available" {
23+
@test "sources bpm-load for Bash" {
24+
BPM_REPO_SOURCE="$BPM_TEST_REPO_ROOT/../source"
25+
26+
eval "$(do-init bash)"
27+
28+
assert_success
29+
assert [ "$(type -t bpm-load)" = 'function' ]
30+
}
31+
32+
33+
@test "sources bpm-load for Zsh" {
34+
BPM_REPO_SOURCE="$BPM_TEST_REPO_ROOT/../source"
35+
36+
eval "$(do-init zsh)"
37+
38+
assert_success
39+
assert [ "$(type -t bpm-load)" = 'function' ]
40+
}
41+
42+
@test "fails if shell is not available" {
2443
run do-init fakesh
2544

2645
assert_failure

0 commit comments

Comments
 (0)