{"_id":"mingy","_rev":"26-fb70e03462ed42b1d63cfcbca213ecd0","name":"mingy","description":"Cheap parsing for your CLI tool and adventure game needs.","dist-tags":{"latest":"0.2.7"},"versions":{"0.0.1":{"name":"mingy","version":"0.0.1","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.0.1","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"602202ae9665b2be2bbaa4f92d76791fcf892b40","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.0.1.tgz","integrity":"sha512-1PxVSE3rblmD7SZMtyosoJIaOZrQceoE3q+tb6Yq5z6HxwND+ALql/GaRW0VdHNKqxnttFVrhsL1OWATyIbvyg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFF00/ZuIRn7GUOzEdougK7DcTomAS9CxglGI2KSt2KIAiEA3CdnBE1oV3KNY6jrL2u1/2pWjE7u9EYP9xt9HUKhUZw="}]}},"0.1.1":{"name":"mingy","version":"0.1.1","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.1.1","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"dc54218ec1b47848b8130515628ae7ee01dc33c8","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.1.1.tgz","integrity":"sha512-PpoGwSWDi5gEBp6rqqcoiuIpEafxQot6CrB9hi3UWJns/y9G7yWEVzxs/GcWiGfznodzK87b/wQ1JGXrywz8sA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFgkynQkKjeOWxfpQ+/JT7HBvjP/EOtx6xNgZkhr3qMRAiEAp13FxAvepMUMTb5uZNUUCzppr3Ko4HUkWudSbHodEnk="}]}},"0.1.2":{"name":"mingy","version":"0.1.2","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.1.2","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js","webServer.js":"lib/webServer.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"de70c702df7e6c21f06ebec55e86bc1c0a67e98b","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.1.2.tgz","integrity":"sha512-n7LGAwQ4I6CnnRwb4Vz3bZ5unZiafboSmMVKrcF/drJCMQLRLCcOw0/9oMAv13oFs7XkrMAGKwrpt8siUWh0CA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIQC5tZbJv7cmaOrYHRKhA+YP/UE9EVIM1K+3jyWfvfeidAIfNygiItUaWN8xiHRS5uFwDEFJ/TYwrPDi3om+YWnKvw=="}]}},"0.1.3":{"name":"mingy","version":"0.1.3","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.1.3","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js","webServer.js":"lib/webServer.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"c57b089bc621398a973dc14c3abe913a055a5dcb","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.1.3.tgz","integrity":"sha512-6Nz2KWugPvCour5mMxSiLVNadgQDoh3g6PHV474pDaTATcBP45LwezmOKCVzI18HvqBwPFyCo1RhAeKo4x5q6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbA4kRECcovXey8XLOHsVT17iyZT5/xbTubTFO3YIjygIgLChbWcWBR7WB2PYlwZzXNz7xPmsV0BhCmyJXqvIxxWg="}]}},"0.2.0":{"name":"mingy","version":"0.2.0","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.2.0","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js","connectMiddleware.js":"lib/connectMiddleware.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"64b8a06ea4d568f6dc5bd5733799256367885bcc","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.0.tgz","integrity":"sha512-yMt4AqiBoOrQzuLa556NdVMVMkJ/wHTXtO+Hhr+t2xxw5fqc8+vYpjEatGl3hU3PONKoEr1zzlR+dKPXM2hdEQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGeexGRQxc8oNoFOq+bTjJKfvbWC1CX7v4NbVF/h6c0vAiEAtSYOHhNklklMfM1bTWkLSCgkCag2Grd+SregCtR2bd8="}]}},"0.2.1":{"name":"mingy","version":"0.2.1","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6","connect":">= 0.5.10"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.2.1","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js","connectMiddleware.js":"lib/connectMiddleware.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"be2ef794dd65180fb7603b417d414a7818f31742","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.1.tgz","integrity":"sha512-1rhcJ9qybLULrXP2Fwzzfnl+bkvOShkmVKFz/KVND/b298Hj+xVKtKA1nDfqLrTcmUNaGMlRFD4Tt7c2ZXd8/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCG6jKIbLtK9qQPfMnPp05gkfOjONMZ6ISQ7K4TsfgN6AIhAInbEHMHBCh4fYTljKTec6YUp8qayjweqxCjvE3tMQLF"}]}},"0.2.3":{"name":"mingy","version":"0.2.3","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6","connect":">= 0.5.10"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"_id":"mingy@0.2.3","_engineSupported":true,"_npmVersion":"0.2.16","_nodeVersion":"v0.3.2-pre","modules":{"command.js":"lib/command.js","mingy.js":"lib/mingy.js","parser.js":"lib/parser.js","shell.js":"lib/shell.js","connectMiddleware.js":"lib/connectMiddleware.js","client.js":"lib/client.js"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"cc9bed7add5251a7232f051cfa6c5f608138792c","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.3.tgz","integrity":"sha512-cFjQswddlGXcPzVV/Funhi/hBhOL9pdv1doEXAA3Sdiumbxq8+8+/z1rYb3TmOxbsrEaaXcAlqHsO2nnNir09g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGsx/WNLu7E0bcTiHRxT+uvFmwxSQGmzVKaLsU9oBjCAIgG5k/aC5ycQ2s/+AJ1x5bUTnZy+Xsx3IzMcpMYk6SiAc="}]}},"0.2.4":{"name":"mingy","version":"0.2.4","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"git://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"devDependencies":{},"_id":"mingy@0.2.4","_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.9","_defaultsLoaded":true,"dist":{"shasum":"35285f14c1d88ee9e84a0fe87f80505a34cac25b","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.4.tgz","integrity":"sha512-NcufJjvKbrNPA4k8eJBmdphzf3VsBZHKTW5lqTqqbDwFobsxs3gKjpnHRmF7VMV+GcGDvdKmXib6BfizN7eMWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHNiiXAn/VFNbfUQQhdWga3BGkaZd5iaqVn9HVIWC3dJAiAgQW284sfQ1Jf1L/sHEb2onA7KZ7myKder1Ayvb/XmKw=="}]},"scripts":{},"maintainers":[{"name":"mcantelon","email":"mcantelon@gmail.com"}]},"0.2.5":{"name":"mingy","version":"0.2.5","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"git://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"devDependencies":{},"_id":"mingy@0.2.5","_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.5.5","_defaultsLoaded":true,"dist":{"shasum":"550a661c687659a5441b1c815c59b9bd730917aa","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.5.tgz","integrity":"sha512-ws+VGdP56niiGCNChYpMB1HfvrNTa7WMPDkM8OwJnAEXSN76S32tjCbo3IMftZIsHIMI8pg0o/AcShlsN/b19g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLfGWIKqSMkLU2/kwDJk5kAJFgwyxSTCyVrRGIFGugWwIgNU9rsyZrWULJLi6Ki1qb5K8cjLl4ZGu8HU93IpBB+Wk="}]},"scripts":{},"maintainers":[{"name":"mcantelon","email":"mcantelon@gmail.com"}]},"0.2.6":{"name":"mingy","version":"0.2.6","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"homepage":"https://github.com/mcantelon/node-mingy","_id":"mingy@0.2.6","dist":{"shasum":"ead83f1bb4ef3a72ef0ae77c2c328f9ad2d4b0b9","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.6.tgz","integrity":"sha512-D0p4BL9MY895LRGNzu+bCGggG3E7ykrs4X2W9lNZgHOrD4dlXBPwe2fq1TG8ALOv/dCvGfFaJc0fVDCQRt3mIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCysFsmv98ohs9Q4ATjD5naU9o8lvddQr/wJPpul8wORgIgIOul58Jj/ukt4RmKKg1/XTOwMYx6hAN1KdLHHsyQHIk="}]},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"mcantelon","email":"mcantelon@gmail.com"},"maintainers":[{"name":"mcantelon","email":"mcantelon@gmail.com"}]},"0.2.7":{"name":"mingy","version":"0.2.7","description":"Cheap parsing for your CLI tool and adventure game needs.","tags":["cli","parsing","adventure"],"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"contributors":[],"dependencies":{"optimist":">= 0.1.6","connect":"~2.13.1"},"main":"./lib/mingy","directories":{"lib":"./lib"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"engines":{"node":">= 0.3.0"},"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"licenses":[{"type":"MIT","url":"http://github.com/mcantelon/node-deja/blob/master/LICENSE"}],"homepage":"https://github.com/mcantelon/node-mingy","_id":"mingy@0.2.7","dist":{"shasum":"f6a73a0a77abc6d97dbf232855963ce07e9358ac","tarball":"https://registry.npmjs.org/mingy/-/mingy-0.2.7.tgz","integrity":"sha512-u4jkHoAXNlmZfiwyVcsOqVk/dMW1TqAV8m+TPwj/DN91BWh05C83VezEivnImPzzp/Q9DmQa9OmHDo9JaAnn+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSFpsj0x74xCpxVN2KithnYMo7rvD4nTZO4X5NRVbRmgIgd49DGK2fwZhEZwbclyLGzVib1LzST700HTwqG8vUZyI="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mcantelon","email":"mcantelon@gmail.com"},"maintainers":[{"name":"mcantelon","email":"mcantelon@gmail.com"}]}},"maintainers":[{"name":"mcantelon","email":"mcantelon@gmail.com"}],"time":{"modified":"2022-06-19T20:43:55.322Z","created":"2011-02-14T18:12:56.573Z","0.0.1":"2011-02-14T18:12:56.871Z","0.1.1":"2011-02-17T05:00:47.434Z","0.1.2":"2011-02-17T16:26:18.613Z","0.1.3":"2011-02-18T16:30:53.362Z","0.2.0":"2011-02-19T08:19:24.740Z","0.2.1":"2011-02-21T20:19:24.470Z","0.2.3":"2011-02-28T02:50:51.496Z","0.2.4":"2011-08-30T03:19:57.235Z","0.2.5":"2011-08-30T03:43:50.973Z","0.2.6":"2014-03-02T05:54:18.239Z","0.2.7":"2014-03-05T20:38:06.634Z"},"author":{"name":"Mike Cantelon","email":"mcantelon@gmail.com"},"repository":{"type":"git","url":"http://github.com/mcantelon/node-mingy.git"},"readme":"    ,---.    ,---..-./`) ,---.   .--.  .-_'''-.      ____     __  \n    |    \\  /    |\\ .-.')|    \\  |  | '_( )_   \\     \\   \\   /  / \n    |  ,  \\/  ,  |/ `-' \\|  ,  \\ |  ||(_ o _)|  '     \\  _. /  '  \n    |  |\\_   /|  | `-'`\"`|  |\\_ \\|  |. (_,_)/___|      _( )_ .'   \n    |  _( )_/ |  | .---. |  _( )_\\  ||  |  .-----. ___(_ o _)'    \n    | (_ o _) |  | |   | | (_ o _)  |'  \\  '-   .'|   |(_,_)'     \n    |  (_,_)  |  | |   | |  (_,_)\\  | \\  `-'`   | |   `-'  /      \n    |  |      |  | |   | |  |    |  |  \\        /  \\      /       \n    '--'      '--' '---' '--'    '--'   `'-...-'    `-..-'     \n\nMingy is a cheap and cheerful command parser/server for node.js CLI tools,\nadventure games, MUDs, and other such endeavors.\n\nFor CLI tools, Mingy works well with\n[node-optimist](https://github.com/substack/node-optimist) (available as\n\"optimist\" via npm). For interactive uses, Mingy includes a shell handler that\nlets you quickly use your commands interactively. A Mingy shell can work\nlocally via the command line or remotely as a server.\n\nMingy includes a number of simple demos, in the \"examples\" directory, that can\ngive you a quick idea how things work. Examples include a CLI calculator, a\nfile navigation shell, a tiny text adventure game, the foundation of a MUD,\na key/value server, and a web application using Mingy for routing.\n\nIn you use npm, simply `npm install mingy` to install.\n\n## Commands\n\nIn order to reap the \"magic\" of mingy you define a number of commands, each of\nwhich has one or more syntax forms.\n\nSyntax forms are strings that define command usage. The syntax form `look`\nwould mean the parser input `look` would trigger the command. The syntax\n`look <prop>` would mean the parser input `look mailbox` or `look demon` would\nboth trigger the command (with the command's \"prop\" argument being set,\nrespectively, to `mailbox` and `demon`).\n\nApplication state is stored by the parser in the env property and is relayed to\ncommands when executed.\n\nAn example command for a text adventure game:\n\n    parser.addCommand('go')\n    .set('syntax', ['go <direction>'])\n    .set('logic', function(args, env) {\n\n      var output = ''\n      var direction = args.direction\n\n      var location = env.locations[env.location]\n\n      if (location.exits[direction]) {\n        output += \"You go \" + direction + \".\\n\"\n        env.location = location.exits[direction]\n      }\n      else {\n        output += \"You can't go that way.\\n\"\n      }\n\n      return output\n    })\n\n## Validators\n\nArguments can either be unvalidated, validated by type, or validated by\nhandlers. Handlers check an argument, returning success or failure and, in\nthe event of failure, an optional error message.\n\nAn example that could be used to validate direction arguments for the text\nadventure game example above:\n\n    parser.addValidator('validDirection', function(lexeme) {\n\n      var validDirections = ['north', 'south', 'east', 'west']\n\n      return {\n        'success': (validDirections.indexOf(lexeme) != -1),\n        'message': \"That's not a direction I understand.\\n\"\n      }\n    })\n\nTo have a validator apply to a command argument the command's syntax form(s)\nmust prefix the name of an argument with the name of a handler and a colon.\nFor example, to enable the above validator on the above command one would\nmake the following change to the command:\n\n    parser.addCommand('go')\n    .set('syntax', ['go <validDirection:direction>'])\n\nValidation by type is simpler. One just needs to prefix the name of an\nargument with the name of the type and a colon. For example:\n\n    parser.addCommand('go')\n    .set('syntax', ['go <string:direction>'])\n\n## Parsing\n\nTo parse command input, either the `Parser.parse` or `Parser.parseLexemes`\nmethods are used. A response string is returned by the method (or, if\nthe parse was unsuccessful, `undefined`).\n\nHere's an example of parsing a string of text input using `Parser.parse`:\n\n    parser.parse('go north')\n\nHere's an example of using `Parser.parseLexemes` to parse an array of\nunhyphenated options returned from node-optimist:\n\n    parser.parseLexemes(argv['_'])\n\nIf your commands contain asynchronous logic and you'd like command output to\nbe handled by a callback, you can supply one in the second argument to either\n`Parser.parse` or `Parser.parseLexemes`. Below is an example:\n\n    parser.parse('go north', function(output) {\n      console.log(output)\n    })\n\nTo set an environmental variable use the `Parser.setEnv` method:\n\n    parser.setEnv('skyIs', 'blue')\n\n## Concatenation\n\nNormally an argument takes a single lexeme. If one wants to have an argument\ncontain a concatenation of all subsequent lexemes adding a `*` after the\nargument name will enable this.\n\nNote that these arguments only work when they are the last argument in a\nsyntax form.\n\nBelow is an example:\n\n    parser.addCommand('say')\n    .set('syntax', ['say <string:message*>'])\n    .set('logic', function(args, env, stream) {\n\n      return \"You say '\" + args['message*'] + \"'.\\n\"\n    })\n\n## Interaction via Shell\n\nSetting up an interactive shell is easy. Below is an example of setting\nup a shell with a couple of useless commands.\n\n    var welcome = \"Welcome to The Shell of Futility. You can brood and shout.\\n\"\n\n    var parser = new Parser()\n\n    parser.addCommand('brood')\n    .set('syntax', ['brood'])\n    .set('logic', function(args) {\n      return \"You stare, angrily, at the floor.\\n\"\n    })\n\n    parser.addCommand('shout')\n    .set('syntax', ['shout'])\n    .set('logic', function(args) {\n      return \"You shout in definance and rage.\\n\"\n    })\n\n    var shell = new Shell(parser)\n    .set('welcome', welcome)\n    .set('prompt', '$ ')\n    .start()\n\n## Interaction via Shell Server\n\nA shell server may be used to provide remote interactivity. The above example\ncan function as a server simply by changing the last line to the following:\n\n    .startServer()\n\nThe shell is now accessible via telnet:\n\n    telnet localhost 8000\n\n## Dealing with Multiple Users\n\nFor multi-user shells, you may wish to use the third optional parameter that\nis sent to command logic. This parameter provides access to context-specific\ndata and functions. When using the shell server a property of this parameter\nis the node.js stream object representing the connection of the user to your\nserver. The shell server adds a `userID` property to the stream. This property\ncan be used to differentiate between users. Please see `examples/mud.js` for\nan example of this.\n\n## Connect Middleware\n\nUsing the included [Connect](https://github.com/senchalabs/connect) middleware\nmodule, Mingy can act as a request router. Please see `examples/web.js` for an\nexample of this.\n\n## Initialization\n\nTo get easy access to Mingy's parser, command, and shell classes, include\nthe folowing code:\n\n    var mingy = require('/path/to/mingy')\n      , Parser = mingy.Parser\n      , Command = mingy.Command\n      , Shell = mingy.Shell\n\nIf you'd like to quickly specify and initialize a number of commands, you\ncan create a hash of them and provide this hash to the parser when\ninitializing. For example:\n\n    var commands = {\n      \"look\": {\n        \"syntax\": [\"look\"],\n        \"logic\": function(args) {\n          return \"You look around.\"\n        }\n      }\n    }\n\n    var parser = new Parser(commands)\n\nSee the [node-deja](https://github.com/mcantelon/node-deja/blob/master/deja.js)\nmodule for a more substantial example of this.\n\n## Testing\n\nTesting requires the [expresso](ihttps://github.com/visionmedia/expresso)\nand [should.js](https://github.com/visionmedia/should.js) modules (available\nvia rpm as \"expresso\" and \"should\" respectively).\n\nRun the tests by entering:\n\n    expresso\n","homepage":"https://github.com/mcantelon/node-mingy","contributors":[],"bugs":{"url":"http://github.com/mcantelon/node-mingy/issues"},"readmeFilename":"README.md","users":{"fwallenborn":true}}