Skip to content

Commit dab4353

Browse files
committed
fix: Small fixes
1 parent 739d064 commit dab4353

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

pkg/lib/cmd/basalt-package-init.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ basalt.package-init() {
2727
source "$BASALT_GLOBAL_REPO/pkg/lib/public/basalt-load.sh"
2828
source "$BASALT_GLOBAL_REPO/pkg/lib/public/basalt-package.sh"
2929
30-
# TODO: this needs to be redone
30+
# TODO: this needs to be redone
3131
if [ -z "$BASALT_PACKAGE_PATH" ]; then
32-
local __old_cd="$PWD"
33-
if [ -L "$0" ]; then
34-
local __file="$(readlink "$0")"
35-
if ! cd "${__file%/*}"; then
36-
printf '%s\n' "Error: basalt-package-init: Could not cd to target of '$0'"
37-
return 1
38-
fi
39-
fi
32+
local __old_cd="$PWD"
33+
if [ -L "$0" ]; then
34+
local __file="$(readlink "$0")"
35+
if ! cd "${__file%/*}"; then
36+
printf '%s\n' "Error: basalt-package-init: Could not cd to target of '$0'"
37+
return 1
38+
fi
39+
fi
4040
4141
if ! BASALT_PACKAGE_PATH="$(
4242
while [ ! -f 'basalt.toml' ] && [ "$PWD" != / ]; do
@@ -52,17 +52,17 @@ basalt.package-init() {
5252
printf '%s' "$PWD"
5353
)"; then
5454
printf '%s\n' "Error: basalt-package-init: Could not find basalt.toml"
55-
if ! cd "$__old_cd"; then
56-
printf '%s\n' "Error: basalt-package-init: Could not cd back to '$__old_cd'"
57-
return 1
58-
fi
59-
return 1
55+
if ! cd "$__old_cd"; then
56+
printf '%s\n' "Error: basalt-package-init: Could not cd back to '$__old_cd'"
57+
return 1
58+
fi
59+
return 1
6060
fi
6161
62-
if ! cd "$__old_cd"; then
63-
printf '%s\n' "Error: basalt-package-init: Could not cd back to '$__old_cd'"
64-
return 1
65-
fi
62+
if ! cd "$__old_cd"; then
63+
printf '%s\n' "Error: basalt-package-init: Could not cd back to '$__old_cd'"
64+
return 1
65+
fi
6666
fi
6767
}
6868
EOF

pkg/lib/public/basalt-load.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ __basalt_load_dosource() {
77
:
88
}
99

10+
# TODO: rename this function to 'basalt-global.sh' or something and the other to 'basalt-local.sh'
1011
basalt.load() {
1112
local __basalt_flag_global='no'
1213
local __basalt_flag_dry='no'

pkg/lib/public/basalt-package.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ basalt.package-load() {
4747
else
4848
shopt -u nullglob
4949
fi
50+
51+
unset __basalt_shopt_nullglob
5052
}

0 commit comments

Comments
 (0)