Skip to content

Commit fd67bc9

Browse files
committed
fix: No longer required passing '--' to pass args for run
1 parent ef014a2 commit fd67bc9

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

pkg/lib/commands/do-run.sh

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,20 @@
33
do-run() {
44
util.init_local
55

6-
local -a args=()
7-
for arg; do case "$arg" in
8-
--)
9-
shift
10-
break
11-
;;
12-
-*)
13-
bprint.die "Flag '$arg' not recognized"
14-
;;
15-
*)
16-
args+=("$arg")
17-
shift
18-
;;
19-
esac done
20-
21-
if ((${#args[@]} == 0)); then
6+
if (($# == 0)); then
227
bprint.die "The name of an executable must be passed"
238
fi
249

25-
if ((${#args[@]} > 1)); then
26-
bprint.die "The only argument must be the executable name"
27-
fi
10+
local bin_name="$0"
11+
shift
2812

2913
# Look in current package
30-
local bin_name="${args[0]}"
3114
if util.get_toml_array "$BASALT_LOCAL_PROJECT_DIR/basalt.toml" 'binDirs'; then
3215
for bin_dir in "${REPLIES[@]}"; do
3316
for bin_file in "$BASALT_LOCAL_PROJECT_DIR/$bin_dir"/*; do
3417
if [ -f "$bin_file" ] && [ -x "$bin_file" ]; then
3518
util.deinit
19+
bprint.info "Running $bin_file"
3620
exec "$bin_file" "$@"
3721
elif [ -f "$bin_file" ]; then
3822
bprint.die "File '$bin_name' is found, but the package providing it has not made it executable"
@@ -47,6 +31,7 @@ do-run() {
4731
local bin_file="$BASALT_LOCAL_PROJECT_DIR/.basalt/bin/$bin_name"
4832
if [ -f "$bin_file" ] && [ -x "$bin_file" ]; then
4933
util.deinit
34+
bprint.info "Running $bin_file"
5035
exec "$bin_file" "$@"
5136
elif [ -f "$bin_file" ]; then
5237
bprint.die "File '$bin_name' is found, but the package providing it has not made it executable"

0 commit comments

Comments
 (0)