Compatible with deno
tch1121 opened this issue · comments
Haw commented
Don't ignore the first two argv
program.parse(Deno.args);
I now use it like this
program.parse(["null", "null", ...Deno.args]);
John Gee commented
Deno have done a great job of filling out node compatibility so Commander works out of the box.
I found three approaches you might use:
- the modern Commander way, leave it to Commander (and the Deno node compatibility):
program.parse();
- if you want to use
Deno.args
then.parse()
supports a second parameter to indicate the argument conventions:
program.parse(Deno.args, { from: 'user' });
- or you could use the compatibility layer explicitly
import * as process from 'node:process';
program.parse(process.argv);
Haw commented
thank you for your work