File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 1- #!/usr/bin/env -S pkgx +deno bash
1+ #!/usr/bin/env -S pkgx +deno +git bash
22
33set -eo pipefail
44
5+ d="$(cd "$(dirname "$0")" && pwd)"
6+
57if test -z "$1"; then
68 if test -z "$PKGX_PANTRY_PATH"; then
79 echo "error: PKGX_PANTRY_PATH is not set" >&2
810 exit 1
911 fi
10- d="$(cd "$(dirname "$0")" && pwd)"
12+
1113 for x in $(echo "$PKGX_PANTRY_PATH" | tr ':' '\n'); do
1214 if test -z "$PKGS" -a -d "$x"/.git; then
1315 #^^^^^^^^^^^^^^^ stop at first match
14- PKGS=($(GIT_WORK_TREE="$x" "$d/status" --print-paths))
16+ PKGS=($(GIT_WORK_TREE="$x" bash "$d/status" --print-paths))
1517 fi
1618 done
1719else
18- PKGS=($(deno run --allow-read --allow-env - <<EoTS
20+ IFS=$'\n'
21+ PKGS=($(cd $d/../.. && deno run --allow-read --allow-env - "$@" <<EoTS
1922 import { hooks } from "pkgx";
2023 const pp = Deno.args.map(arg => hooks.usePantry().find(arg).then(x => x.map(y => y.path.string)));
2124 const paths = await Promise.all(pp);
22- console.log(paths.flatMap (x => x).join("\n" ));
25+ paths.flat().forEach (x => console.log(x ));
2326 Deno.exit(0);
2427EoTS
2528 ))
26-
27- echo "${PKGS[@]}"
2829fi
2930
3031if test -z "$EDITOR"; then
@@ -53,7 +54,7 @@ if test -z "$PKGS"; then
5354 echo "usage: bk edit <pkgspec>" >&2
5455 fi
5556 exit 1
56- elif test "$EDITOR" = code; then
57+ elif test "$EDITOR" = code -a -n "$PKGX_PANTRY_PATH" ; then
5758 exec $EDITOR "$PKGX_PANTRY_PATH" "${PKGS[@]}"
5859 # ^^ be more useful
5960else
You can’t perform that action at this time.
0 commit comments