function parseArgs
Usage in Deno
```typescript import { parseArgs } from "node:node__util.d.ts"; ```
parseArgs<T extends ParseArgsConfig>(config?: T): ParsedResults<T>
Provides a higher level API for command-line argument parsing than interacting
with `process.argv` directly. Takes a specification for the expected arguments
and returns a structured object with the parsed options and positionals.
```js
import { parseArgs } from 'node:util';
const args = ['-f', '--bar', 'b'];
const options = {
foo: {
type: 'boolean',
short: 'f',
},
bar: {
type: 'string',
},
};
const {
values,
positionals,
} = parseArgs({ args, options });
console.log(values, positionals);
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
```
T extends ParseArgsConfig
optional
config: T
Used to provide arguments for parsing and to configure the parser. `config` supports the following properties:
The parsed command line arguments: