{"id":13483449,"url":"https://github.com/75lb/command-line-args","last_synced_at":"2025-05-13T18:09:18.646Z","repository":{"id":17426983,"uuid":"20200164","full_name":"75lb/command-line-args","owner":"75lb","description":"A mature, feature-complete library to parse command-line options.","archived":false,"fork":false,"pushed_at":"2025-03-09T16:46:56.000Z","size":1034,"stargazers_count":709,"open_issues_count":8,"forks_count":106,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-25T15:48:46.850Z","etag":null,"topics":["argv","command-line-parser","getopt","nodejs-modules","npm-package","option-parser"],"latest_commit_sha":null,"homepage":"","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/75lb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2014-05-26T22:35:23.000Z","updated_at":"2025-04-04T09:50:29.000Z","dependencies_parsed_at":"2024-11-18T14:20:02.010Z","dependency_job_id":"53f0e4ea-a87c-42a1-836c-213a6e516bf6","html_url":"https://github.com/75lb/command-line-args","commit_stats":{"total_commits":403,"total_committers":12,"mean_commits":"33.583333333333336","dds":0.03970223325062039,"last_synced_commit":"bfc3d9dcb5d5cf62ba4d5da2c9dbfe85e8bad8b8"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-args","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-args/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-args/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-args/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/command-line-args/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254000850,"owners_count":21997441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["argv","command-line-parser","getopt","nodejs-modules","npm-package","option-parser"],"created_at":"2024-07-31T17:01:11.359Z","updated_at":"2025-05-13T18:09:18.622Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"[![view on npm](https://badgen.net/npm/v/command-line-args)](https://www.npmjs.org/package/command-line-args)\n[![npm module downloads](https://badgen.net/npm/dt/command-line-args)](https://www.npmjs.org/package/command-line-args)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/command-line-args)](https://github.com/75lb/command-line-args/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/command-line-args)](https://github.com/75lb/command-line-args/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/command-line-args/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/command-line-args/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n***Upgraders, please read the [release notes](https://github.com/75lb/command-line-args/releases)***\n\n# command-line-args\n\nA mature, feature-complete library to parse command-line options.\n\n## Synopsis\n\nYou can set options using the main notation standards ([learn more](https://github.com/75lb/command-line-args/wiki/Notation-rules)). These commands are all equivalent, setting the same values:\n```\n$ example --verbose --timeout=1000 --src one.js --src two.js\n$ example --verbose --timeout 1000 --src one.js two.js\n$ example -vt 1000 --src one.js two.js\n$ example -vt 1000 one.js two.js\n```\n\nTo access the values, first create a list of [option definitions](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md) describing the options your application accepts. The [`type`](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md#optiontype--function) property is a setter function (the value supplied is passed through this), giving you full control over the value received.\n\n```js\nconst optionDefinitions = [\n  { name: 'verbose', alias: 'v', type: Boolean },\n  { name: 'src', type: String, multiple: true, defaultOption: true },\n  { name: 'timeout', alias: 't', type: Number }\n]\n```\n\nNext, parse the options using [commandLineArgs()](https://github.com/75lb/command-line-args/blob/master/doc/API.md#commandlineargsoptiondefinitions-options--object-):\n\n```js\nimport commandLineArgs from 'command-line-args'\nconst options = commandLineArgs(optionDefinitions)\n```\n\n`options` now looks like this:\n\n```js\n{\n  src: [\n    'one.js',\n    'two.js'\n  ],\n  verbose: true,\n  timeout: 1000\n}\n```\n\n### Advanced usage\n\nBeside the above typical usage, you can configure command-line-args to accept more advanced syntax forms.\n\n* [Command-based syntax](https://github.com/75lb/command-line-args/wiki/Implement-command-parsing-(git-style)) (git style) in the form:\n\n  ```\n  $ executable \u003ccommand\u003e [options]\n  ```\n\n  For example.\n\n  ```\n  $ git commit --squash -m \"This is my commit message\"\n  ```\n\n* [Command and sub-command syntax](https://github.com/75lb/command-line-args/wiki/Implement-multiple-command-parsing-(docker-style)) (docker style) in the form:\n\n  ```\n  $ executable \u003ccommand\u003e [options] \u003csub-command\u003e [options]\n  ```\n\n  For example.\n\n  ```\n  $ docker run --detached --image centos bash -c yum install -y httpd\n  ```\n\n## Usage guide generation\n\nA usage guide (typically printed when `--help` is set) can be generated using [command-line-usage](https://github.com/75lb/command-line-usage). See the examples below and [read the documentation](https://github.com/75lb/command-line-usage) for instructions how to create them.\n\nA typical usage guide example.\n\n![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/footer.png)\n\nThe [polymer-cli](https://github.com/Polymer/polymer-cli/) usage guide is a good real-life example.\n\n![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/polymer.png)\n\n## Further Reading\n\nThere is plenty more to learn, please see [the wiki](https://github.com/75lb/command-line-args/wiki) for examples and documentation.\n\n## Install\n\n```sh\n$ npm install command-line-args --save\n```\n* * *\n\n\u0026copy; 2014-24 [Lloyd Brookes](https://github.com/75lb) \\\u003copensource@75lb.com\\\u003e.\n\nDocumented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcommand-line-args","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Fcommand-line-args","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcommand-line-args/lists"}