dsherret / dax

Cross-platform shell tools for Deno and Node.js inspired by zx.
MIT License
969 stars 33 forks source link

Consider being able to spawn the executable or script at a `PathRef` #145

Closed dsherret closed 1 year ago

dsherret commented 1 year ago

It would be nice to be able to spawn an executable or script with shebang at a PathRef like so:

const ciScript = $.path("./.github/workflows/ci.generate.ts");
await ciScript.run();
dsherret commented 1 year ago

Not going to do this. First of all, run() is not a good name because it returns back a CommandBuilder, which someone could then call spawn() on, which is awkward. Most importantly though, people would want to be able to provide arguments to this and escaping them could get tricky. So for that reason, I recommend passing the PathRef directly to a $ like so:

const ciScript = $.path("./.github/workflows/ci.generate.ts");
await $`${ciScript}`;

This works today.