温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/util/parseArgs
点击访问原文链接

Node util.parseArgs function | API Reference | Bun

Node util.parseArgs function | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:util/parseArgsFparseArgs

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:util/parseArgsFparseArgs

function

util.parseArgsfunction parseArgsT extends ParseArgsConfig>(config?: T): ParsedResultsT>;

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.

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' } []
@param config

Used to provide arguments for parsing and to configure the parser. config supports the following properties:

@returns

The parsed command line arguments:

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node util.parseArgs function | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function node:util.parseArgs | Bun