{"id":13396724,"url":"https://github.com/yargs/yargs","last_synced_at":"2026-04-10T10:02:31.911Z","repository":{"id":37755208,"uuid":"14210523","full_name":"yargs/yargs","owner":"yargs","description":" yargs the modern, pirate-themed successor to optimist.","archived":false,"fork":false,"pushed_at":"2026-03-23T17:59:33.000Z","size":5372,"stargazers_count":11466,"open_issues_count":315,"forks_count":1016,"subscribers_count":76,"default_branch":"main","last_synced_at":"2026-04-02T23:06:36.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://yargs.js.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yargs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-11-07T17:25:51.000Z","updated_at":"2026-04-02T11:53:42.000Z","dependencies_parsed_at":"2023-02-09T14:15:16.996Z","dependency_job_id":"930c817b-41be-4c2f-a474-51c9d1d8ccea","html_url":"https://github.com/yargs/yargs","commit_stats":{"total_commits":1592,"total_committers":287,"mean_commits":5.547038327526132,"dds":0.7920854271356784,"last_synced_commit":"ef28c98ae14621fd484ec80b128b46e85b6bf858"},"previous_names":["bcoe/yargs","chevex/yargs"],"tags_count":222,"template":false,"template_full_name":null,"purl":"pkg:github/yargs/yargs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yargs%2Fyargs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yargs%2Fyargs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yargs%2Fyargs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yargs%2Fyargs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yargs","download_url":"https://codeload.github.com/yargs/yargs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yargs%2Fyargs/sbom","scorecard":{"id":228641,"data":{"date":"2025-07-07","repo":{"name":"github.com/yargs/yargs","commit":"086aeaa7d6793e7f369aa0aaa3e4f962ad878469"},"scorecard":{"version":"v5.2.1-18-gbb9c347d","commit":"bb9c347dff6349d986baab6578a46d68a5524c62"},"score":6.7,"checks":[{"name":"Code-Review","score":8,"reason":"Found 22/27 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#packaging"}},{"name":"Maintained","score":10,"reason":"12 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release-please.yml:10","Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yaml:9","Info: found token with 'none' permissions: .github/workflows/release-please.yml:1"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/ci.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-please.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/release-please.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/release-please.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/release-please.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/yargs/yargs/release-please.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:60","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:61","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:23","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:25","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:44","Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:45","Warn: npmCommand not pinned by hash: .github/workflows/release-please.yml:25","Warn: npmCommand not pinned by hash: .github/workflows/release-please.yml:26","Warn: npmCommand not pinned by hash: .github/workflows/release-please.yml:45","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   9 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T04:22:11.303Z","repository_id":37755208,"created_at":"2025-08-17T04:22:11.303Z","updated_at":"2025-08-17T04:22:11.303Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31373243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:53:18.093Z","status":"ssl_error","status_checked_at":"2026-04-03T17:53:17.617Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:01:01.263Z","updated_at":"2026-04-10T10:02:31.875Z","avatar_url":"https://github.com/yargs.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"250\" src=\"https://raw.githubusercontent.com/yargs/yargs/main/yargs-logo.png\"\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003e Yargs \u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cb \u003eYargs be a node.js library fer hearties tryin' ter parse optstrings\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n![ci](https://github.com/yargs/yargs/workflows/ci/badge.svg)\n[![NPM version][npm-image]][npm-url]\n[![js-standard-style][standard-image]][standard-url]\n[![Coverage][coverage-image]][coverage-url]\n[![Conventional Commits][conventional-commits-image]][conventional-commits-url]\n\n## Description\nYargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.\n\nIt gives you:\n\n* commands and (grouped) options (`my-program.js serve --port=5000`).\n* a dynamically generated help menu based on your arguments:\n\n```\nmocha [spec..]\n\nRun tests with Mocha\n\nCommands\n  mocha inspect [spec..]  Run tests with Mocha                         [default]\n  mocha init \u003cpath\u003e       create a client-side Mocha setup at \u003cpath\u003e\n\nRules \u0026 Behavior\n  --allow-uncaught           Allow uncaught errors to propagate        [boolean]\n  --async-only, -A           Require all tests to use a callback (async) or\n                             return a Promise                          [boolean]\n```\n\n* generate completion scripts for Bash and Zsh for your command\n* and [tons more](/docs/api.md).\n\n## Installation\n\nStable version:\n```bash\nnpm i yargs\n```\n\nBleeding edge version with the most recent features:\n```bash\nnpm i yargs@next\n```\n\n## Usage\n\n### Simple Example\n\n```javascript\n#!/usr/bin/env node\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nconst argv = yargs(hideBin(process.argv)).parse()\n\nif (argv.ships \u003e 3 \u0026\u0026 argv.distance \u003c 53.5) {\n  console.log('Plunder more riffiwobbles!')\n} else {\n  console.log('Retreat from the xupptumblers!')\n}\n```\n\n```bash\n$ ./plunder.js --ships=4 --distance=22\nPlunder more riffiwobbles!\n\n$ ./plunder.js --ships 12 --distance 98.7\nRetreat from the xupptumblers!\n```\n\n\u003e Note: `hideBin` is a shorthand for `process.argv.slice(2)`. It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690).\n\n### Complex Example\n\n```javascript\n#!/usr/bin/env node\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nyargs(hideBin(process.argv))\n  .command('serve [port]', 'start the server', (yargs) =\u003e {\n    return yargs\n      .positional('port', {\n        describe: 'port to bind on',\n        default: 5000\n      })\n  }, (argv) =\u003e {\n    if (argv.verbose) console.info(`start server on :${argv.port}`)\n    serve(argv.port)\n  })\n  .option('verbose', {\n    alias: 'v',\n    type: 'boolean',\n    description: 'Run with verbose logging'\n  })\n  .parse()\n```\n\nRun the example above with `--help` to see the help for the application.\n\n## Supported Platforms\n\n### TypeScript\n\nyargs has type definitions at [@types/yargs][type-definitions].\n\n```\nnpm i @types/yargs --save-dev\n```\n\nSee usage examples in [docs](/docs/typescript.md).\n\n### Deno\n\nAs of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):\n\n```typescript\nimport yargs from 'https://deno.land/x/yargs@v17.7.2-deno/deno.ts'\nimport { Arguments } from 'https://deno.land/x/yargs@v17.7.2-deno/deno-types.ts'\n\nyargs(Deno.args)\n  .command('download \u003cfiles...\u003e', 'download a list of files', (yargs: any) =\u003e {\n    return yargs.positional('files', {\n      describe: 'a list of files to do something with'\n    })\n  }, (argv: Arguments) =\u003e {\n    console.info(argv)\n  })\n  .strictCommands()\n  .demandCommand(1)\n  .parse()\n```\n\n\u003e Note: If you use version tags in url then you also have to add `-deno` flag on the end, like `@17.7.2-deno`\n\n### Usage in Browser\n\nSee examples of using yargs in the browser in [docs](/docs/browser.md).\n\n## Documentation\n\n### Table of Contents\n\n* [Yargs' API](/docs/api.md)\n* [Examples](/docs/examples.md)\n* [Parsing Tricks](/docs/tricks.md)\n  * [Stop the Parser](/docs/tricks.md#stop)\n  * [Negating Boolean Arguments](/docs/tricks.md#negate)\n  * [Numbers](/docs/tricks.md#numbers)\n  * [Arrays](/docs/tricks.md#arrays)\n  * [Objects](/docs/tricks.md#objects)\n  * [Quotes](/docs/tricks.md#quotes)\n* [Advanced Topics](/docs/advanced.md)\n  * [Composing Your App Using Commands](/docs/advanced.md#commands)\n  * [Building Configurable CLI Apps](/docs/advanced.md#configuration)\n  * [Customizing Yargs' Parser](/docs/advanced.md#customizing)\n* [Contributing](/contributing.md)\n\n## Supported Node.js Versions\n\nLibraries in this ecosystem make a best effort to track\n[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a\npost on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).\n\n[npm-url]: https://www.npmjs.com/package/yargs\n[npm-image]: https://img.shields.io/npm/v/yargs.svg\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard-url]: http://standardjs.com/\n[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg\n[conventional-commits-url]: https://conventionalcommits.org/\n[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs\n[coverage-image]: https://img.shields.io/nycrc/yargs/yargs\n[coverage-url]: https://github.com/yargs/yargs/blob/main/.nycrc\n","funding_links":[],"categories":["命令行","Packages","JavaScript","Uncategorized","3. Engineering","Backend","Repository","包","*.js","Modules","others","Command-line utilities","目录","CLI","[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)","NodeJS","3. 命令行程序","Node","Node.js / JavaScript 🟨"],"sub_categories":["Command-line utilities","Uncategorized","3.1. Cli Tools","Command-line Utilities","命令行工具","CLI","Node","redux 扩展","CLI utils","macros","End to End","Useful awesome list for Go cli","命令行实用工具","3.1 开发库","命令行"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyargs%2Fyargs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyargs%2Fyargs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyargs%2Fyargs/lists"}