-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running a stand-alone subcommand with zx #1592
Comments
If you make
If the file has a source extension then const sourceExt = ['.js', '.ts', '.tsx', '.mjs', '.cjs']; |
great, that works! thanks for the explanation, @shadowspawn the only downside seems to be missing syntax highlighting due to the undefined file extension for editors… |
For interest... Commander expects by default that But when launched by // foo.mjs
console.log(process.argv);
I think if |
good point. maybe this is due to does this mean, i could tamper with the |
If you can modify |
looking good, e.g. console.log(process.argv.length) // 4
process.argv.shift();
console.log(process.argv.length) // 3 |
and now zx works with scripts having file extension, too! awesome. |
An answer was provided, and no further activity in a month. Closing this as resolved. Feel free to open a new issue if it comes up again, with new information and renewed interest. |
We are trying to combine CommanderJS and zx in subcommand and I noticed the zx extensions are not available then:
As a work-around we certainly could import the extensions again (e.g. with
import { $ } from "zx"
) but it feels a bit redundant and wrong.Is there an option to run a stand-alone subcommand with the correct binary? Or make CommanderJS respect the shebang
#!/usr/bin/env zx
?The text was updated successfully, but these errors were encountered: