{"id":13548354,"url":"https://github.com/tandrewnichols/opted","last_synced_at":"2025-03-18T00:31:04.586Z","repository":{"id":57315764,"uuid":"39396567","full_name":"tandrewnichols/opted","owner":"tandrewnichols","description":"Stringify an object to command line options","archived":false,"fork":false,"pushed_at":"2017-08-31T04:17:31.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T05:39:35.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tandrewnichols.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-20T16:55:22.000Z","updated_at":"2017-09-25T14:23:34.000Z","dependencies_parsed_at":"2022-08-25T22:40:49.302Z","dependency_job_id":null,"html_url":"https://github.com/tandrewnichols/opted","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fopted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fopted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fopted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fopted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tandrewnichols","download_url":"https://codeload.github.com/tandrewnichols/opted/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658270,"owners_count":20326467,"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-01T12:01:09.230Z","updated_at":"2025-03-18T00:31:04.236Z","avatar_url":"https://github.com/tandrewnichols.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/tandrewnichols/opted.png)](https://travis-ci.org/tandrewnichols/opted) [![downloads](http://img.shields.io/npm/dm/opted.svg)](https://npmjs.org/package/opted) [![npm](http://img.shields.io/npm/v/opted.svg)](https://npmjs.org/package/opted) [![Code Climate](https://codeclimate.com/github/tandrewnichols/opted/badges/gpa.svg)](https://codeclimate.com/github/tandrewnichols/opted) [![Test Coverage](https://codeclimate.com/github/tandrewnichols/opted/badges/coverage.svg)](https://codeclimate.com/github/tandrewnichols/opted) [![dependencies](https://david-dm.org/tandrewnichols/opted.png)](https://david-dm.org/tandrewnichols/opted)\n\n# opted\n\nStringify an object to command line options\n\n## Installation\n\n`npm install --save opted`\n\n## Usage\n\nOpted is _not_ a command line option parser. Rather, it is a library for stringifying an object into a list of command line arguments. E.g.\n\n```js\nvar opted = require('opted');\nvar args = opted({ foo: 'bar' });\nconsole.log(args); // ['--foo', 'bar']\n```\n\n## Types of flags\n\n### Long\n\nOptions are [kebab-cased](https://lodash.com/docs#kebabCase) and prefixed with '--'.\n\n```js\nconsole.log( opted({ foo: 'bar' }) ); // ['--foo', 'bar']\nconsole.log( opted({ fooBar: 'baz' }) ); // ['--foo-bar', 'baz']\n```\n\n### Short\n\nOptions that have single letter abbreviations can also be used.\n\n```js\nconsole.log( opted({ f: 'bar' }) ); // ['-f', 'bar']\n```\n\n### Boolean\n\nOptions that are simple \"on\", but have no value, can be set to `true`. Setting a flag to false, will add 'no' to the beginning.\n\n```js\nconsole.log( opted({ bananas: true }) ); // ['--bananas']\nconsole.log( opted({ bananas: false }) ); // ['--no-bananas']\n```\n\n### Equal style\n\nOptions that include an equal sign will keep the equal sign.\n\n```js\nconsole.log( opted({ 'name=', 'Andrew' }) ); // ['--name=Andrew']\n```\n\n### List\n\nMultiple options for a single flag can be passed in an array.\n\n```js\nconsole.log( opted({ member: ['Bob', 'Larry'] }) ); // ['--member', 'Bob', '--member', 'Larry']\n```\n\n## But wait, the tool I need to pass args to is some bizarre abomination like \"find\" that uses single dashes...\n\nNo problem. Just enable crazy-arg mode by passing true as the second parameter.\n\n```js\nconsole.log( opted({ hello: 'world' }, true) ); // ['-hello', 'world']\n```\n\n## Contributing\n\nPlease see [the contribution guidelines](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftandrewnichols%2Fopted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftandrewnichols%2Fopted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftandrewnichols%2Fopted/lists"}