File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env -S pkgx +deno bash +exo pipefail
22
3+ eval "$(pkgx --shellcode)"
4+
35d="$(cd "$(dirname "$0")"/.. && pwd)"
46
57get_parameters() {
@@ -10,23 +12,29 @@ get_parameters() {
1012 const pkg = await parse_pkg_str('$1')
1113 const entrypoint = await hooks.usePantry().project(pkg).yaml().then(x => x?.['entrypoint'])
1214 if (!entrypoint) Deno.exit(1)
13- const prefix = (await hooks.useCellar().resolve(pkg)).path.string
14- console.log(pkg.project, prefix, entrypoint)
15+ console.log(pkg.project, entrypoint)
1516EoTS
1617}
1718
18- run() {
19- project=$1
20- shift
21- cd "$1"
22- shift
23- eval "$(pkgx --shellcode)"
24- env +$project
25- "$@"
19+ get_keg() {
20+ deno run --config="$d/deno.jsonc" -A - <<EoTS
21+ import { hooks, semver } from 'pkgx'
22+ const pkg = {project: '$1', constraint: new semver.Range('*') }
23+ const prefix = (await hooks.useCellar().resolve(pkg)).path.string
24+ console.log(prefix)
25+ EoTS
2626}
2727
2828pkg=$1
2929shift
3030
31+ # get project and entrypoint
3132params=($(get_parameters $pkg))
32- run "${params[@]}" "$@"
33+
34+ # install and add env
35+ env +${params[0]}
36+
37+ cd "$(get_keg ${params[0]})"
38+
39+ # run entrypoint
40+ "${params[@]:1}" "$@"
You can’t perform that action at this time.
0 commit comments