{"_id":"macro-store","_rev":"227937","name":"macro-store","description":"Get and set macros created by commandline arguments.","dist-tags":{"latest":"0.3.1"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T15:44:01.000Z","created":"2016-06-13T18:25:03.572Z","0.3.1":"2016-08-17T21:43:10.899Z","0.3.0":"2016-08-11T17:37:20.858Z","0.2.0":"2016-08-11T01:25:29.307Z","0.1.0":"2016-06-13T18:25:03.572Z"},"users":{},"author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/macro-store.git"},"versions":{"0.3.1":{"name":"macro-store","description":"Get and set macros created by commandline arguments.","version":"0.3.1","homepage":"https://github.com/doowb/macro-store","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/macro-store.git"},"bugs":{"url":"https://github.com/doowb/macro-store/issues"},"license":"MIT","files":["index.js","lib"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"data-store":"^0.16.1","debug":"^2.2.0","extend-shallow":"^2.0.1","lazy-cache":"^2.0.1","yargs-parser":"^3.1.0"},"devDependencies":{"gulp":"github:gulpjs/gulp#4.0","gulp-eslint":"^3.0.1","gulp-format-md":"^0.1.10","gulp-istanbul":"^1.0.0","gulp-mocha":"^3.0.0","mocha":"^3.0.2","rimraf":"^2.5.4"},"keywords":["assemble","cli","data","data-store","generate","macro","macro-store","macros","store","update","verb"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["data-store","minimist","verb","verb-generate-readme","yargs-parser"],"lint":{"reflinks":true},"related":{"list":["data-store","minimist","verb","verb-generate-readme","yargs-parser"]}},"gitHead":"29cb4f578e162aab5acedc72a313d97694d58a33","_id":"macro-store@0.3.1","_shasum":"283a7710f775e954673c734af0b5b240fa223f8d","_from":".","_npmVersion":"3.7.5","_nodeVersion":"5.1.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"283a7710f775e954673c734af0b5b240fa223f8d","size":6161,"noattachment":false,"key":"/macro-store/-/macro-store-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/macro-store/download/macro-store-0.3.1.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/macro-store-0.3.1.tgz_1471470189323_0.28168297256343067"},"directories":{},"publish_time":1471470190899,"_cnpm_publish_time":1471470190899,"_hasShrinkwrap":false},"0.3.0":{"name":"macro-store","description":"Get and set macros created by commandline arguments.","version":"0.3.0","homepage":"https://github.com/doowb/macro-store","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/macro-store.git"},"bugs":{"url":"https://github.com/doowb/macro-store/issues"},"license":"MIT","files":["index.js","lib"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"data-store":"^0.16.1","debug":"^2.2.0","extend-shallow":"^2.0.1","lazy-cache":"^2.0.1","yargs-parser":"^3.1.0"},"devDependencies":{"gulp":"github:gulpjs/gulp#4.0","gulp-eslint":"^3.0.1","gulp-format-md":"^0.1.10","gulp-istanbul":"^1.0.0","gulp-mocha":"^3.0.0","mocha":"^3.0.2","rimraf":"^2.5.4"},"keywords":["assemble","cli","data","data-store","generate","macro","macro-store","macros","store","update","verb"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["data-store","minimist","verb","verb-generate-readme","yargs-parser"],"lint":{"reflinks":true},"related":{"list":["data-store","minimist","verb","verb-generate-readme","yargs-parser"]}},"gitHead":"1c9b2dec45566b1ca65a790ed4ab8a880086287f","_id":"macro-store@0.3.0","_shasum":"f09555ecb0b5879ef356ed203459a0200c6f398e","_from":".","_npmVersion":"3.7.5","_nodeVersion":"5.1.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"f09555ecb0b5879ef356ed203459a0200c6f398e","size":6115,"noattachment":false,"key":"/macro-store/-/macro-store-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/macro-store/download/macro-store-0.3.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/macro-store-0.3.0.tgz_1470937038965_0.5558219070080668"},"directories":{},"publish_time":1470937040858,"_cnpm_publish_time":1470937040858,"_hasShrinkwrap":false},"0.2.0":{"name":"macro-store","description":"Get and set macros created by commandline arguments.","version":"0.2.0","homepage":"https://github.com/doowb/macro-store","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/macro-store.git"},"bugs":{"url":"https://github.com/doowb/macro-store/issues"},"license":"MIT","files":["index.js","lib"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"data-store":"^0.16.1","debug":"^2.2.0","extend-shallow":"^2.0.1","lazy-cache":"^2.0.1","yargs-parser":"^3.1.0"},"devDependencies":{"gulp":"github:gulpjs/gulp#4.0","gulp-eslint":"^3.0.1","gulp-format-md":"^0.1.10","gulp-istanbul":"^1.0.0","gulp-mocha":"^3.0.0","mocha":"^3.0.2","rimraf":"^2.5.4"},"keywords":["assemble","cli","data","data-store","generate","macro","macro-store","macros","store","update","verb"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["data-store","date-store","verb","verb-generate-readme"],"lint":{"reflinks":true},"related":{"list":[]}},"gitHead":"c92b8035ad871947393c5dd2940fa5cc60ba1a37","_id":"macro-store@0.2.0","_shasum":"88de6864e519134b84a409e823618ae1caf8c45b","_from":".","_npmVersion":"3.7.5","_nodeVersion":"5.1.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"88de6864e519134b84a409e823618ae1caf8c45b","size":5040,"noattachment":false,"key":"/macro-store/-/macro-store-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/macro-store/download/macro-store-0.2.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/macro-store-0.2.0.tgz_1470878728425_0.9757841262035072"},"directories":{},"publish_time":1470878729307,"_cnpm_publish_time":1470878729307,"_hasShrinkwrap":false},"0.1.0":{"name":"macro-store","description":"Get and set macros created by commandline arguments.","version":"0.1.0","homepage":"https://github.com/doowb/macro-store","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/macro-store.git"},"bugs":{"url":"https://github.com/doowb/macro-store/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"data-store":"^0.16.0","debug":"^2.2.0","lazy-cache":"^2.0.1"},"devDependencies":{"gulp-format-md":"^0.1.9","mocha":"^2.5.3","rimraf":"^2.5.2"},"keywords":["assemble","cli","data","data-store","generate","macro","macro-store","macros","store","update","verb"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["verb","data-store"],"lint":{"reflinks":true}},"gitHead":"f1a69bdfad1bed63923b9cdbf6836dcf79cf0514","_id":"macro-store@0.1.0","_shasum":"3eaca0067c244bb3ded8d2fab362ed9bf6f2f292","_from":".","_npmVersion":"3.7.5","_nodeVersion":"5.1.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"3eaca0067c244bb3ded8d2fab362ed9bf6f2f292","size":3180,"noattachment":false,"key":"/macro-store/-/macro-store-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/macro-store/download/macro-store-0.1.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/macro-store-0.1.0.tgz_1465842300404_0.16681091976352036"},"directories":{},"publish_time":1465842303572,"_cnpm_publish_time":1465842303572,"_hasShrinkwrap":false}},"readme":"# macro-store [![NPM version](https://img.shields.io/npm/v/macro-store.svg?style=flat)](https://www.npmjs.com/package/macro-store) [![NPM downloads](https://img.shields.io/npm/dm/macro-store.svg?style=flat)](https://npmjs.org/package/macro-store) [![Build Status](https://img.shields.io/travis/doowb/macro-store.svg?style=flat)](https://travis-ci.org/doowb/macro-store)\n\nGet and set macros created by commandline arguments.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save macro-store\n```\n\n## Usage\n\nCreate a [parser](#parser) function that works like [yargs-parser](https://github.com/yargs/yargs-parser) or [minimist](https://github.com/substack/minimist) and handles [creating](#create-a-macro), [using](#use-a-macro), and [removing](#delete-a-macro) macros through command line arguments.\n\n```js\nvar macros = require('macro-store');\nvar parser = macros('macro-store');\nvar args = parser(process.argv.slice(2));\n//=> { _: ['foo', 'bar', 'baz'], verbose: true, cwd: 'qux', isMacro: 'qux' }\n```\n\nThe returned `args` object also contains the [store methods](#store-1) to give implementors direct access to [setting](#set), [getting](#get), and [deleting](#del) macros in the store.\n\n```js\nargs.set('foo', ['bar', 'baz', 'bang']);\nargs.get('foo');\n//=> ['bar', 'baz', 'bang']\n```\n\n## CLI examples\n\nThe following examples are using the [example file](example.js) run at the command line with `node example.js`.\nThe objects returned may be used in implementing applications however they choose.\n\nJump to [the API documentation](#api) for implementation information.\n\n### Create a macro\n\nThe following shows creating a simple macro called `foo`.\n\n![image](https://raw.githubusercontent.com/doowb/macro-store/master/docs/set-simple-macro.png)\n\n### Use a macro\n\nThe following shows using the `foo` macro, and that the resulting `args` object contains the expanded value.\n\n![image](https://raw.githubusercontent.com/doowb/macro-store/master/docs/get-simple-macro.png)\n\n### Create a complex macro\n\nThe following shows creating a complex macro called `qux` that includes options `--verbose` and `--cwd boop`.\n\n![image](https://raw.githubusercontent.com/doowb/macro-store/master/docs/set-complex-macro.png)\n\n### Using a complex macro\n\nThe following shows that using a complex macro is the same as a simple macro, but the `args` object contains the options `verbose: true` and `cwd: 'boop'`, which were set when creating the `qux` macro.\n\n![image](https://raw.githubusercontent.com/doowb/macro-store/master/docs/get-complex-macro.png)\n\n### Delete a macro\n\nThe following shows how to delete the macro `foo`. This only deletes `foo` and shows that `qux` is still set.\n\n![image](https://raw.githubusercontent.com/doowb/macro-store/master/docs/delete-macro.png)\n\n### Deleting all macros\n\nThe following shows how to delete all macros. This shows that `foo` and `qux` have been deleted so the `args` object will contain the exact values passed in from the command line.\n\n![image](https://raw.githubusercontent.com/doowb/macro-store/master/docs/delete-all-macros.png)\n\n## API\n\n### [macros](index.js#L54)\n\nHandle macro processing and storing for an array of arguments.\n\nSet macros by specifying using the `--macro` or `--macro=set` option and a list of values.\nRemove a macro by specifying `--macro=del` option and the macro name.\nDefault is to replace values in the `argv` array with stored macro values (if found).\n\n**Params**\n\n* `name` **{String}**: Custom name of the [data-store](https://github.com/jonschlinkert/data-store) to use. Defaults to 'macros'.\n* `options` **{Object}**: Options to pass to the store to control the name or instance of the [data-store](https://github.com/jonschlinkert/data-store)\n* `options.name` **{String}**: Name of the [data-store](https://github.com/jonschlinkert/data-store) to use for storing macros. Defaults to `macros`\n* `options.store` **{Object}**: Instance of [data-store](https://github.com/jonschlinkert/data-store) to use. Defaults to `new DataStore(options.name)`\n* `options.parser` **{Function}**: Custom argv parser to use. Defaults to [yargs-parser](https://github.com/yargs/yargs-parser)\n* `returns` **{Function}**: argv parser to process macros\n\n**Example**\n\n```js\n// create an argv parser\nvar parser = macros('custom-macro-store');\n\n// parse the argv\nvar args = parser(process.argv.slice(2));\n// => { _: ['foo'] }\n\n// following input will produce the following results:\n//\n// Set 'foo' as ['bar', 'baz', 'bang']\n// $ app --macro foo bar baz bang\n// => { _: [ 'bar', 'baz', 'bang' ], macro: 'foo' }\n//\n// Use 'foo'\n// $ app foo\n// => { _: [ 'bar', 'baz', 'bang' ], isMacro: 'foo' }\n//\n// Remove the 'foo' macro\n// $ app --macro --del foo\n// => { _: [ 'foo' ], macro: 'del' }\n```\n\n### [parser](index.js#L76)\n\nParser function used to parse the argv array and process macros.\n\n**Params**\n\n* `argv` **{Array}**: Array of arguments to process\n* `options` **{Object}**: Additional options to pass to the argv parser\n* `returns` **{Object}** `args`: object [described above](#macros)\n\n### [.Store](index.js#L122)\n\nExposes `Store` for low level access\n\n**Example**\n\n```js\nvar store = new macros.Store('custom-macro-store');\n```\n\n### [Store](lib/store.js#L30)\n\nInitialize a new `Store` with the given `options`.\n\n**Params**\n\n* `options` **{Object}**\n* `options.name` **{String}**: Name of the json file to use for storing macros. Defaults to 'macros'\n* `options.store` **{Object}**: Instance of [data-store](https://github.com/jonschlinkert/data-store) to use. Allows complete control over where the store is located.\n\n**Example**\n\n```js\nvar macroStore = new Store();\n//=> '~/data-store/macros.json'\n\nvar macroStore = new Store({name: 'abc'});\n//=> '~/data-store/abc.json'\n```\n\n### [.set](lib/store.js#L56)\n\nSet a macro in the store.\n\n**Params**\n\n* `key` **{String}**: Name of the macro to set.\n* `arr` **{Array}**: Array of strings that the macro will resolve to.\n* `returns` **{Object}** `this`: for chaining\n\n**Example**\n\n```js\nmacroStore.set('foo', ['foo', 'bar', 'baz']);\n```\n\n### [.get](lib/store.js#L78)\n\nGet a macro from the store.\n\n**Params**\n\n* `name` **{String}**: Name of macro to get.\n* `returns` **{String|Array}**: Array of tasks to get from a stored macro, or the original name when a stored macro does not exist.\n\n**Example**\n\n```js\nvar tasks = macroStore.get('foo');\n//=> ['foo', 'bar', 'baz']\n\n// returns input name when macro is not in the store\nvar tasks = macroStore.get('bar');\n//=> 'bar'\n```\n\n### [.del](lib/store.js#L95)\n\nRemove a macro from the store.\n\n**Params**\n\n* `name` **{String|Array}**: Name of a macro or array of macros to remove.\n* `returns` **{Object}** `this`: for chaining\n\n**Example**\n\n```js\nmacroStore.del('foo');\n```\n\n## Release history\n\n### key\n\nChangelog entries are classified using the following labels _(from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog)_):\n\n* `added`: for new features\n* `changed`: for changes in existing functionality\n* `deprecated`: for once-stable features removed in upcoming releases\n* `removed`: for deprecated features removed in this release\n* `fixed`: for any bug fixes\n\nCustom labels used in this changelog:\n\n* `dependencies`: bumps dependencies\n* `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories.\n\n### v0.3.0\n\n**changed**\n\n* refactored parser to return an `args` object similar to [yargs-parser](https://github.com/yargs/yargs-parser) and [minimist](https://github.com/substack/minimist)\n* handles `--macro` option for creating, getting, and removing macros from the `args` object.\n\n### v0.2.0\n\n**changed**\n\n* refactored to export a function that creates a parser function.\n* the parser function returns an object with the action taken and the processed arguments.\n\n## About\n\n### Related projects\n\n* [data-store](https://www.npmjs.com/package/data-store): Easily get, set and persist config data. | [homepage](https://github.com/jonschlinkert/data-store \"Easily get, set and persist config data.\")\n* [minimist](https://www.npmjs.com/package/minimist): parse argument options | [homepage](https://github.com/substack/minimist \"parse argument options\")\n* [verb-generate-readme](https://www.npmjs.com/package/verb-generate-readme): Generate your project's readme with verb. Requires verb v0.9.0 or higher. | [homepage](https://github.com/verbose/verb-generate-readme \"Generate your project's readme with verb. Requires verb v0.9.0 or higher.\")\n* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb \"Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.\")\n* [yargs-parser](https://www.npmjs.com/package/yargs-parser): the mighty option parser used by yargs | [homepage](https://github.com/yargs/yargs-parser#readme \"the mighty option parser used by yargs\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_\n\nTo generate the readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-generate-readme && verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d && npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](http://twitter.com/doowb)\n\n### License\n\nCopyright © 2016, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT license](https://github.com/doowb/macro-store/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on August 17, 2016._","_attachments":{},"homepage":"https://github.com/doowb/macro-store","bugs":{"url":"https://github.com/doowb/macro-store/issues"},"license":"MIT"}