{"id":14155861,"url":"https://github.com/TrigenSoftware/Argue","last_synced_at":"2025-08-06T02:30:42.572Z","repository":{"id":20037777,"uuid":"23305931","full_name":"TrigenSoftware/Argue","owner":"TrigenSoftware","description":"A thin and strongly typed CLI arguments parser for Node.js.","archived":false,"fork":false,"pushed_at":"2024-11-14T18:20:32.000Z","size":526,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-04T23:12:17.496Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/TrigenSoftware.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"dangreen"}},"created_at":"2014-08-25T07:43:10.000Z","updated_at":"2024-07-11T00:12:29.000Z","dependencies_parsed_at":"2024-03-10T19:25:15.159Z","dependency_job_id":"dd6383f7-5be5-4530-9eb5-e45b3aa17c8b","html_url":"https://github.com/TrigenSoftware/Argue","commit_stats":{"total_commits":78,"total_committers":5,"mean_commits":15.6,"dds":0.4358974358974359,"last_synced_commit":"0f837bc0448b15199ddd72d15b2f8f12ff8db2b0"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrigenSoftware%2FArgue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrigenSoftware%2FArgue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrigenSoftware%2FArgue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrigenSoftware%2FArgue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrigenSoftware","download_url":"https://codeload.github.com/TrigenSoftware/Argue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228828995,"owners_count":17978127,"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":[],"created_at":"2024-08-17T08:05:03.272Z","updated_at":"2024-12-09T03:30:41.635Z","avatar_url":"https://github.com/TrigenSoftware.png","language":"TypeScript","funding_links":["https://ko-fi.com/dangreen"],"categories":["others"],"sub_categories":[],"readme":"# argue-cli\n\n[![ESM-only package][package]][package-url]\n[![NPM version][npm]][npm-url]\n[![Node version][node]][node-url]\n[![Dependencies status][deps]][deps-url]\n[![Install size][size]][size-url]\n[![Build status][build]][build-url]\n[![Coverage status][coverage]][coverage-url]\n\n[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg\n[package-url]: https://nodejs.org/api/esm.html\n\n[npm]: https://img.shields.io/npm/v/argue-cli.svg\n[npm-url]: https://www.npmjs.com/package/argue-cli\n\n[node]: https://img.shields.io/node/v/argue-cli.svg\n[node-url]: https://nodejs.org\n\n[deps]: https://img.shields.io/librariesio/release/npm/argue-cli\n[deps-url]: https://libraries.io/npm/argue-cli/tree\n\n[size]: https://packagephobia.com/badge?p=argue-cli\n[size-url]: https://packagephobia.com/result?p=argue-cli\n\n[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/Argue/tests.yml?branch=master\n[build-url]: https://github.com/TrigenSoftware/Argue/actions\n\n[coverage]: https://img.shields.io/codecov/c/github/TrigenSoftware/Argue.svg\n[coverage-url]: https://app.codecov.io/gh/TrigenSoftware/Argue\n\nA thin and strongly typed CLI arguments parser for Node.js.\n\n## Usage\n\n1. Install\n\n```bash\n# pnpm\npnpm add argue-cli\n# yarn\nyarn add argue-cli\n# npm\nnpm i argue-cli\n```\n\n2. Import in your code and use it!\n\n```ts\nimport { read, end, expect, alias, option, readOptions } from 'argue-cli'\n\n/**\n * Expect and read one of the commands\n */\nconst command = expect(\n  alias('install', 'i'),\n  'remove'\n)\nlet options = {}\n\nif (command === 'install') {\n  /**\n   * Read passed options\n   */\n  options = readOptions(\n    option(alias('save', 'S'), Boolean),\n    option(alias('saveDev', 'save-dev', 'D'), Boolean),\n    option('workspace', String)\n  )\n}\n\n/**\n * Read next argument\n */\nconst packageName = read()\n\n/**\n * Expect end of the arguments\n */\nend()\n\n/* ... */\n```\n\n## API\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eMethod\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n\u003ctd\u003e\n\n```ts\nfunction read(): string\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n  Read next argument. Throws error if no next argument.\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n\u003ctd\u003e\n\n```ts\nfunction end(): void\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n  Expectation of the end. Throws an error if there are more arguments left.\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n\u003ctd\u003e\n\n```ts\nfunction expect(...argRefs: ArgRef[]): string\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n  Expect one of the given arguments.\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n\u003ctd\u003e\n\n```ts\nfunction alias(name: string, ...aliases: string[]): AliasArgRef\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n  Describe argument with aliases.\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n\u003ctd\u003e\n\n```ts\nfunction option(argRef: ArgRef, type: PrimitiveConstructor): OptionReader\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n  Describe option with value.\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n\u003ctd\u003e\n\n```ts\nfunction readOptions(...optionReaders: OptionReader[]): OptionResult\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n  Read options from arguments.\n\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## TypeScript\n\nIn [API section](#API) types are described in a simplified way. Detailed example of the types you can see [here](test/argue.test-d.ts).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrigenSoftware%2FArgue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTrigenSoftware%2FArgue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrigenSoftware%2FArgue/lists"}