File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ basalt.main() {
36
36
add) shift ; do-add " $@ " ;;
37
37
remove) shift ; do-remove " $@ " ;;
38
38
install) shift ; do-install " $@ " ;;
39
+ run) shift ; do-run " $@ " ;;
39
40
complete) shift ; do-complete " $@ " ;;
40
41
global) shift
41
42
case " $1 " in
Original file line number Diff line number Diff line change
1
+ # shellcheck shell=bash
2
+
3
+ do-run () {
4
+ util.init_local
5
+
6
+ local -a args=()
7
+ for arg; do case " $arg " in
8
+ -* )
9
+ print.die " Flag '$arg ' not recognized"
10
+ ;;
11
+ * )
12
+ args+=(" $arg " )
13
+ ;;
14
+ esac done
15
+
16
+ if (( ${# args[@]} > 1 )) ; then
17
+ newindent.die " The only argument must be the executable name"
18
+ fi
19
+
20
+ local bin_name=" ${args[0]} "
21
+ local bin_file=" $BASALT_LOCAL_PROJECT_DIR /.basalt/bin/$bin_name "
22
+ if [ -x " $bin_file " ]; then
23
+ exec " $bin_file "
24
+ elif [ -f " $bin_file " ]; then
25
+ newindent.die " File '$bin_name ' is found, but the package providing it has not made it executable"
26
+ else
27
+ newindent.die " No executable called '$bin_name ' was found"
28
+ fi
29
+ }
Original file line number Diff line number Diff line change @@ -360,6 +360,9 @@ Local subcommands:
360
360
list [--fetch] [--format=<simple>] [package...]
361
361
Lists particular dependencies for the current local project
362
362
363
+ run <command>
364
+ Runs a particular command from any particular locally installed package
365
+
363
366
Global subcommands:
364
367
init <shell>
365
368
Prints shell code that must be evaluated during shell
You can’t perform that action at this time.
0 commit comments