{"id":15416331,"url":"https://github.com/herber/argi","last_synced_at":"2025-04-05T13:14:17.557Z","repository":{"id":57183533,"uuid":"101285233","full_name":"herber/argi","owner":"herber","description":"A simple args parser","archived":false,"fork":false,"pushed_at":"2017-10-05T05:56:07.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T02:49:42.715Z","etag":null,"topics":["args","argument-parser","arguments","argv","parser"],"latest_commit_sha":null,"homepage":null,"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/herber.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}},"created_at":"2017-08-24T10:54:24.000Z","updated_at":"2021-10-03T16:33:47.000Z","dependencies_parsed_at":"2022-08-23T01:20:38.445Z","dependency_job_id":null,"html_url":"https://github.com/herber/argi","commit_stats":null,"previous_names":["tobihrbr/argi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fargi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fargi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fargi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fargi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/herber","download_url":"https://codeload.github.com/herber/argi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339159,"owners_count":20923014,"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":["args","argument-parser","arguments","argv","parser"],"created_at":"2024-10-01T17:11:39.221Z","updated_at":"2025-04-05T13:14:17.535Z","avatar_url":"https://github.com/herber.png","language":"JavaScript","readme":"# argi [![Codestyle fyi](https://img.shields.io/badge/code%20style-fyi-E91E63.svg)](https://github.com/tobihrbr/fyi) [![Build Status](https://travis-ci.org/herber/argi.svg?branch=master)](https://travis-ci.org/herber/argi) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/rvyedmu554502dlc?svg=true)](https://ci.appveyor.com/project/tobihrbr/argi) [![Coverage Status](https://coveralls.io/repos/github/tobihrbr/argi/badge.svg?branch=master)](https://coveralls.io/github/tobihrbr/argi?branch=master)\n\n\u003e A simple args parser\n\n## Install\n\n```\n$ npm install --save argi\n```\n\n## Usage\n\n```js\nconst argi = require('argi');\n\n// Options\nargi.option('name', 'description', { default: 'bob', aliases: 'n', boolean: false, hidden: false });\n\n// Commands\nargi.command('sayhi', 'description', { hidden: false });\n\n// Parse argv\nconst parsed = argi.parse(process.argv.slice(2));\n\nif (parsed.sayhi) {\n  console.log(`Hi ${ parsed.name }!`);\n} else {\n  console.log(args.help());\n}\n```\n\n## API\n\n### argi.options(name, description[, options])\n\n#### name\n\nType: `string`\n\nThe option's name.\n\n#### description\n\nType: `string`\n\nWhat the option does. Will be used for help.\n\n#### options\n\nType: `object`\n\n##### default\n\nType: `string`\n\nThe options default value.\n\n##### aliases\n\nType: `string`, `array`\n\nAlias names for the option.\n\n##### boolean\n\nType: `boolean`\nDefault: `false`\n\nSpecifies whether the option is a boolean(`true`/`false`) or a string. If set to true arguments after the option will count as a command or as a separate option.\n\nExample:\n\n```js\n...\n\nargi.option('boolean', 'description', { boolean: true });\n\nconst parsed = argi.parse(['--boolean', 'value'])\nparsed.boolean // =\u003e true\nparsed._ // =\u003e ['value']\n\n...\n```\n\n##### hidden\n\nType: `boolean`\nDefault: `false`\n\nIf option should be displayed in help.\n\n### argi.command(name, description[, options])\n\n#### name\n\nType: `string`\n\nThe command's name.\n\n#### description\n\nType: `string`\n\nWhat the command does. Will be used for help.\n\n#### options\n\nType: `object`\n\n##### hidden\n\nType: `boolean`\nDefault: `false`\n\nIf command should be displayed in help.\n\n### argi.help()\n\nReturns a help string. Will throw an error if it's called before argi.parse()\n\n### argi.parse(argv)\n\n#### argv\n\nAn array of cli options. You should probably set it to `process.argv.slice(2)`\n\nReturns an object with the option's values and if commands should be executed.\n\nExample:\n\n```js\n...\n\nconst parsed = argi.parse(['--test', '--opt', 'yes', 'build']);\n// =\u003e {\n// =\u003e   test: true,\n// =\u003e   opt: 'yes',\n// =\u003e   build: true\n// =\u003e }\n\n...\n```\n\n## License\n\nMIT © [Tobias Herber](https://tobihrbr.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherber%2Fargi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fherber%2Fargi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherber%2Fargi/lists"}