-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Description
Version: Deno 1.40.5
import { parseArgs } from "node:util";
const parsedArgs = parseArgs({
options: { hello: { type: "string" } },
allowPositionals: true,
});
console.log(parsedArgs);node a.js --args hello a
{ values: [Object: null prototype] { hello: 'a' }, positionals: [] }
deno run a.js --args hello a
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'execArgv')
const parsedArgs = parseArgs({
^
at getMainArgs (ext:deno_node/internal/util/parse_args/parse_args.js:53:28)
at parseArgs (ext:deno_node/internal/util/parse_args/parse_args.js:162:48)
at file:///home/mrcool/dev/lab/c/a.js:3:20
the above is already tracked by #22363
But the behavior is still not the same
import { parseArgs } from "node:util";
const parsedArgs = parseArgs({
args: [],
options: {
handler: {
type: "string",
default: "hello",
},
},
});
console.log(parsedArgs.values.handler);Running with not arguments
deno -> undefined
nodejs -> hello
okuryu
Metadata
Metadata
Assignees
Labels
No labels