{"id":16445874,"url":"https://github.com/sporeball/yeow","last_synced_at":"2025-03-23T08:32:15.875Z","repository":{"id":57403574,"uuid":"341707051","full_name":"sporeball/yeow","owner":"sporeball","description":"CLI helper with attitude","archived":false,"fork":false,"pushed_at":"2021-07-27T00:20:25.000Z","size":21,"stargazers_count":16,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T11:29:06.415Z","etag":null,"topics":["arguments","cli","command-line","javascript"],"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/sporeball.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":"2021-02-23T22:23:31.000Z","updated_at":"2022-01-20T19:36:56.000Z","dependencies_parsed_at":"2022-09-04T07:12:37.547Z","dependency_job_id":null,"html_url":"https://github.com/sporeball/yeow","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Fyeow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Fyeow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Fyeow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Fyeow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sporeball","download_url":"https://codeload.github.com/sporeball/yeow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"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":["arguments","cli","command-line","javascript"],"created_at":"2024-10-11T09:45:40.850Z","updated_at":"2025-03-23T08:32:15.559Z","avatar_url":"https://github.com/sporeball.png","language":"JavaScript","funding_links":["https://patreon.com/sporeball"],"categories":[],"sub_categories":[],"readme":"# yeow\n\n\u003ca href=\"https://www.npmjs.com/package/yeow\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/yeow\" /\u003e\u003c/a\u003e\n\n**yeow** is a CLI helper with attitude \u0026mdash; part [meow](https://github.com/sindresorhus/meow), part [yargs](https://github.com/yargs/yargs), and built to spite the both of them.\n\nthings yeow **does**:\n- parse arguments\n- assert types\n- fail if given incorrect arguments\n\nthings yeow **doesn't do**:\n- negate arguments with `--no-`\n- interpret arguments as an array\n- restrict valid values to a predetermined list\n\n### install\n```\n$ npm i --save yeow\n```\n\n### usage\n```js\n#!/usr/bin/env node\nconst args = require(\"yeow\")({\n  \"exclamation\": {\n    type: \"string\",\n    required: true\n  },\n  \"int\": {\n    type: \"number\",\n    aliases: \"--integer\",\n    default: 16\n  }\n});\n\nconsole.log(args);\n```\n```\n$ ./logger.js \"yeow!\"\n{ exclamation: 'yeow!', int: 16 }\n\n$ ./logger.js \"cool!\" --integer 100\n{ exclamation: 'cool!', int: 100 }\n```\n\n## API\n\n### yeow(obj)\nreturns an `object` of parsed arguments from the passed `obj`.\n\n#### obj\ntype: `object`\n\neach key is a human-readable argument name. the value is an object with any of:\n\n##### type\ntype: `string`\n\ntype of the argument.\n\npossible values:\n- `string`\n- `number`\n- `file`\n\nif this is omitted, the argument will become a simple `true`/`false` flag.\n\n##### required\ntype: `boolean`\\\ndefault: `false`\n\nwhether the argument is required. required arguments ignore `aliases` and `default`.\n\nthe *n*-th argument for which `required` is set to `true` **must** be passed as the *n*-th argument to the program.\n\n##### missing\ntype: `string`\n\nerror message to output if the argument is omitted.\n\nif the argument is not `required`, this will be ignored.\n\n##### aliases\ntype: `string`\n\nvalid aliases for the argument, space-slash-space separated.\n\nexample values:\n- `-a`\n- `-a / --argument`\n\nif the argument is `required`, this will be ignored.\n\n##### extensions\ntype: `string`\n\nvalid file extensions for the argument, space-slash-space separated.\n\nexample values:\n- `.txt`\n- `.js / .jsx`\n\nif the argument's `type` is not `file`, this will be ignored.\\\nif this is omitted, the argument will accept files of any extension.\n\n##### default\ntype: `string | number`\n\na default value the argument will have if it is omitted. the value's type should match the argument's `type`.\n\nif the argument is `required`, this will be ignored.\n\n##### invalid\ntype: `string`\n\nerror message to output if the argument is passed with an invalid type.\n\n### example\n```js\nconst args = require(\"yeow\")({\n  \"script\": {\n    type: \"file\",\n    extensions: \".js\",\n    required: true,\n    missing: \"a file must be passed\",\n    invalid: \"not a .js file\"\n  },\n  \"delay\": {\n    type: \"number\",\n    aliases: \"-d / --delay\",\n    default: 1\n  },\n  \"input\": {\n    type: \"string\",\n    aliases: \"--input\",\n  },\n  \"verbose\": {\n    aliases: \"-v / --verbose\"\n  }\n});\n```\n\n### donate\nyou can support the development of this project and others via Patreon:\n\n[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dsporeball%26type%3Dpledges%26suffix%3D%252Fmonth\u0026style=for-the-badge)](https://patreon.com/sporeball)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsporeball%2Fyeow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsporeball%2Fyeow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsporeball%2Fyeow/lists"}