{"_id":"readcommand","_rev":"32-3784802a6c42109e7782dd2e3e5ce000","name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","dist-tags":{"latest":"0.4.0"},"versions":{"0.0.2":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.0.2","homepage":"https://github.com/mrvisser/node-readcommand","author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.0.2","dist":{"shasum":"8f8ec0448900b89f016640f9268b5bf883779fcc","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.0.2.tgz","integrity":"sha512-PyZBBLpWonLXoODSSrwOjylTIVp+wKqN0gJPwEqGskmv5QVumBCPktCEGDFxUXPcIezFVETI+98Q2jyoq7iiMA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDo/JyzD1UQd7Eje22p7mfkRRH3RSV5CUHKAZMSGVfirQIhAKnnh8KDyOYYey36Nb+GVJVRWYPxCtu0xG6pnDvZmAo/"}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"directories":{}},"0.0.3":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.0.3","homepage":"https://github.com/mrvisser/node-readcommand","author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.0.3","dist":{"shasum":"94cdc281f4c7d1a4e169b261fcebddbc30e8d192","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.0.3.tgz","integrity":"sha512-VRVz+myGPNRLNHwzN2/Mx5cgX5j8JkwaDcg0K1dlxPScqdbh+z9xydPGdpu5twRerQQbcvc7AQzlT04mgEXZ1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAuw9cY9sQBciJUk50NyBfn1zp7aabUb5W9ph6sIEqYcAiEAqDeiX+3kBxdCVxJV9qwPPpSATU+0vwNecZsRXiIoO3Y="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"directories":{}},"0.0.4":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.0.4","homepage":"https://github.com/mrvisser/node-readcommand","author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.0.4","dist":{"shasum":"cf541bdc353c5410093b5930185f22d362092c71","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.0.4.tgz","integrity":"sha512-L+xBzzdDiUoZ4RrNA+qDvzvF7eCcqR6DP21pkNXTqxpaeFLt1Sd85HhWXRMijreHYkdLB4okoPITQYYLjHStjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbS46DKIKOyL7dM2h5nJuJcsabCWtZdaHtbgSkwDYiBwIgIrKRBwFJhMG6emCu8w69CMM4+On2JQTd4toAhtIVNDk="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"directories":{}},"0.0.5":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.0.5","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.0.5","dist":{"shasum":"b1d6c92abd0f4995ca326c32b45564842732ecea","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.0.5.tgz","integrity":"sha512-+g5acQ6siK6jyhAacwyRRchxGIFjmCm/w4gp7YHz2iQdU2Yt6mMhSJK3OO96ptU7j4+LEjz3AsdCoenfkMtDqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwFK8L8zZ6Gdi68eEIUgXTaU0SeC0jnonywUpXljn97gIgXsOXYgzAk7kng2e7YKqu2VHey4O8LDSVFhOGRrzrvEY="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"directories":{}},"0.1.0":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.1.0","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.1.0","_shasum":"f5359ee3168627923d7a6bc44f8460717ab33ad0","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"dist":{"shasum":"f5359ee3168627923d7a6bc44f8460717ab33ad0","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.1.0.tgz","integrity":"sha512-qyq6FsF5qhD5EExLfrCGor4sgAnkqqywsF74sRkhJpTJT0/3a63gPRajp6woySR8Yx/VM0CEBz9XrwE/WPoBcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBccE4EwDdISAan1FxF1/BPtB7FzVcO2wk+PkDHKAGtiAiEA5C6uqcD40O7z47zuINKuMyy9lwqpU3rB1BlEQvf0o9A="}]},"directories":{}},"0.2.0":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.2.0","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.2.0","_shasum":"f39a98697ecd27f50aa2ac94997781f118f64b09","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"dist":{"shasum":"f39a98697ecd27f50aa2ac94997781f118f64b09","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.2.0.tgz","integrity":"sha512-syw+7jSph/lMzCFSl8YTRYL15/QaHan1XOhzl2EPo3owBY400K5uDnDWb+WVFxPbYRyjiLGTZWaVbxeKC2NV+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBc4N2p/h/SGbeG0EjhaTqMYHn+k33itTTFaLE5tioC/AiA8oC7mUvWsKnYEFHM5KBs1Lxg0SLbiP15iAuIeVW9obQ=="}]},"directories":{}},"0.2.1":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.2.1","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"latest"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.2.1","_shasum":"027c11b3c5c1c40a3ca54b29de849dbb14c15062","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"dist":{"shasum":"027c11b3c5c1c40a3ca54b29de849dbb14c15062","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.2.1.tgz","integrity":"sha512-+oP1YAGcisAbzH0DHImpNT8BsR+xPo3XNEfER8oUGZjHPJJHrfVRRaUmJ3IxtoI5HVS8U61jRNDChzy0RtOI7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIML+FZJKQj0RrgG/QHMINpErJuPnn/XsvnBXwzVmsLgIhAPCrYjB9ebxa7uUBa6xqG0tN3muSMRd8AFvNvyOQbIIL"}]},"directories":{}},"0.2.2":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.2.2","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"1.6.x"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"_id":"readcommand@0.2.2","_shasum":"f9aa89d2cf06029b8a483762e9aa90105f8bc22f","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"dist":{"shasum":"f9aa89d2cf06029b8a483762e9aa90105f8bc22f","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.2.2.tgz","integrity":"sha512-zPDuTuoWM5+vn4Rq6zLslp/I0w2ezdBEhyxk47S0pDtAGIXaHR1EDem8zVG7a7y/cR61/N6tSkVU+12gonb7zw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXd1nwwZnEmwxSp6+u71GFJxUMUCbjRyWpeaXr2/uGLQIgXDmGelqDNugCC26uPvq42hr/wxDyMqFOn5Q64uaiLOg="}]},"directories":{}},"0.2.3":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.2.3","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"1.6.x"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"gitHead":"e636ca26c7ac3ed190c074571f71184efb6fe754","_id":"readcommand@0.2.3","scripts":{},"_shasum":"f7ad91832fab469f4121acdefa1ad396bcb761d7","_from":".","_npmVersion":"2.0.0-beta.0","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"dist":{"shasum":"f7ad91832fab469f4121acdefa1ad396bcb761d7","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.2.3.tgz","integrity":"sha512-M9CcwAVcVEqz46hOXCaUgtMsCDwJVis0vCnnafpaN/XE9qzHxT3U8FXhTLdHImInhjPs1Pd44YYeZIv1xRw4aw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0N/p+oxiSe3WpAQq0BkZ3JLFMRepQMrA+Mb9NgZIPDAIgWQ73q+N7VO2gmYYPCvHqA/gAf1LBKzpm/6a0RZbPD3s="}]},"directories":{}},"0.3.0":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.3.0","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"1.6.x"},"devDependencies":{"grunt":"latest","grunt-mocha-test":"latest","grunt-release":"~0.7.0"},"engines":{"node":">=0.8"},"gitHead":"38eb03a2d870075e1909ab2a6810cc995aa73a58","_id":"readcommand@0.3.0","scripts":{},"_shasum":"471d65c78cfbe21c4e5d82e9cb331ba8104e9988","_from":".","_npmVersion":"2.0.0-beta.0","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"dist":{"shasum":"471d65c78cfbe21c4e5d82e9cb331ba8104e9988","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.3.0.tgz","integrity":"sha512-ulXFIZbuUaSooAuFO2SVJ6gonm7UrVa0aqk3oVlveTvA8cLlq04wbcvl5fKBTPMTiMAoAJhuS1U7GJcx2u7KpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0KmXctRHx8dbkZrlJlt/+OMtMzNdd5iQBsGw2LTBHLgIgEa/6FS40HKQEaG+7yW05pWewF7zNWfCex6yrkN8Ozms="}]},"directories":{}},"0.4.0":{"name":"readcommand","description":"An extension to readline that reads and parses a multi-line shell command","version":"0.4.0","homepage":"https://github.com/mrvisser/node-readcommand","keywords":["arguments","argv","command","commands","parse","shell"],"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"main":"./index.js","dependencies":{"underscore":"1.13.1"},"devDependencies":{"mocha":"^9.0.1","release-it":"^14.10.0"},"scripts":{"release":"release-it","test":"mocha tests/**.js"},"engines":{"node":">=0.8"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"gitHead":"c937a621b9ba5f983ff05b90119f3ee09e9b2a60","_id":"readcommand@0.4.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","_npmUser":{"name":"mrvisser","email":"mrvisser@gmail.com"},"dist":{"integrity":"sha512-41QcOdvUJHfdOw2ucVyb8A5w/yC4MgpyS1yUDhYyswuPdGNBGFSVhGXuXWn4b4vl0vhYgZI4OyNTc7Nib3k4/g==","shasum":"a8f1d5d4d4a58bd0abd9ff87592840cde96b8390","tarball":"https://registry.npmjs.org/readcommand/-/readcommand-0.4.0.tgz","fileCount":17,"unpackedSize":63308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg0eUiCRA9TVsSAnZWagAAolgQAIPrEIWrTCAE5wHITxZf\n1jT5L3LXVtzMNyWlbrOU6pHrWtnl8tpjfhDYmrjb4Rc9U1RDAPB3c9b+5pWl\nuOVREFI5uypeP1KqtLV5LCWKHqLf9lzNhdGi4auMoMI24RMmO2wgxMax+Ikc\n24TTRifV4f7sgaBrJ5MI8XkTO9mNnSS6d2NJPwqAGZcJsh5asIx7+llpf6cn\njyNDg+Qg/db1i6wH4qlzwZygSrqwxjUrH6rWlWhcG+/J6lKCTMGixIXdaNHn\ng/zb7ci98cdzH9wLcRtl74H3fNw69ZbR4mwO0Mg1+mae4otaBQzZiOiB4C+Y\nmX/21x7fdKS8ETHYWkCXWXqc5hgOxVNy3TD2UqM78s1nHPjhkfv4pcty5Zzz\nS57+DQiUZg5pBDDMZphVIybI8FZdsTdhZ6OJKtg7jAKneaH6DVTEUgiYmahI\nEk4ptC9+fvApUaiBlMe7cqXdpzyQQhSJ1uzgGKmHm32CcBXsqMIrNdpVKij0\n95JXUTsadVI0FfWn3BdbuusSeBvzVO7WMtGzfFOooBbqTeGhUcvEd3KobmYK\n6VLFvBBF6YFfTX6699564hOXj+TaQCtDOSAi3G08vQmVELEf/ecviPK65NZk\nEaVb4SqxAR2PkIhP0vBI4DCZADrVD4+eXj932IA3y///x9PV1cVLRuFcxSLo\nUenv\r\n=G4ST\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBdFfEH0OvfH1FtJ9Kl4dXBJRZ98D/TvEmyDdVNwikggAiAd4wuUP2G5ECqsv/wsZBOKj92/n5HTFPaxb4lRi7g9bA=="}]},"directories":{},"maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readcommand_0.4.0_1624368418043_0.4795075309382597"},"_hasShrinkwrap":false}},"readme":"\n## ReadCommand\n\n[![Build Status](https://travis-ci.org/mrvisser/node-readcommand.png?branch=master)](https://travis-ci.org/mrvisser/node-readcommand)\n\nA utility that wraps the built-in node.js `readline` functionality to parse multi-line shell commands. This module was extracted from work that was bloating in [node-corporal](https://github.com/mrvisser/node-corporal), a utility that makes building CLI apps FUN.\n\n## Features\n\n* Argument parsing from the user's input\n* Multi-line command input\n* Command history navigation using `up` and `down` arrow keys\n* Auto-complete hook for argument auto-completion\n\n## API\n\n* [readcommand.read(options, callback)](https://github.com/mrvisser/node-readcommand/blob/master/index.js#L54-L80)\n    * Read a single command from the user\n\n* [readcommand.loop(options, callback)](https://github.com/mrvisser/node-readcommand/blob/master/index.js#L10-L39)\n    * Read commands from the user in an interactive loop\n\n## Examples\n\n### Read a single command\n\nThis is the most simple example, reading a command from a user in your interactive shell, and parsing it into an arguments array like `process.argv`, then printing it to the console.\n\n```javascript\nrequire('readcommand').read(function(err, args) {\n    console.log('Arguments: %s', JSON.stringify(args))\n});\n```\n\nExample usage:\n\n```\n$ node simple.js\n> mycommand --arg1 val1 --arg2 val2\nArguments: [\"mycommand\",\"--arg1\",\"val1\",\"--arg2\",\"val2\"]\n```\n\nAnd multi-line goodness!\n\n```\n$ node simple.js\n> mycommand \\\n>   --arg1 val1 \\\n>   --arg2 val2\nArguments: [\"mycommand\",\"--arg1\",\"val1\",\"--arg2\",\"val2\"]\n```\n\n### Read a single command with history\n\nProvide a history array for the user to toggle through using up/down keys.\n\n```javascript\nrequire('readcommand').read({'history': ['cd', 'ls', 'curl', 'ps -aux | grep node', 'netstat -r']}, function(err, args) {\n    console.log('Arguments: %s', JSON.stringify(args))\n});\n```\n\n### Start a command loop\n\nThis example starts an interactive command prompt, where each command is provided to the callback function. After 2 SIGINT invocations by the user, the loop terminates. After each command, it prints the parsed arguments. The command history is maintained within the command loop.\n\n```javascript\nvar readcommand = require('readcommand');\n\nvar sigints = 0;\n\nreadcommand.loop(function(err, args, str, next) {\n    if (err && err.code !== 'SIGINT') {\n        throw err;\n    } else if (err) {\n        if (sigints === 1) {\n            process.exit(0);\n        } else {\n            sigints++;\n            console.log('Press ^C again to exit.');\n            return next();\n        }\n    } else {\n        sigints = 0;\n    }\n\n    console.log('Received args: %s', JSON.stringify(args));\n    return next();\n});\n```\n\n### Auto-complete\n\nThe auto-complete functionality wraps `readline`'s autocomplete functionality, providing an API that works with high-level parsed argument replacement instead of low-level loose string replacement.\n\nThe following example provides replacements for either argument keys or argument values depending on context:\n\n```javascript\nvar _ = require('underscore');\nvar readcommand = require('readcommand');\n\nvar possibleArguments = [\n    '--verbose',\n    '--log-level'\n];\n\nvar possibleLogLevels = [\n    'trace',\n    'debug',\n    'info',\n    'warn',\n    'error'\n];\n\nreadcommand.loop({'autocomplete': _autocomplete}, function(err, args, str, next) {\n    if (err) {\n        return;\n    }\n\n    console.log('executed: %s', JSON.stringify(args));\n    return next();\n});\n\nfunction _autocomplete(args, callback) {\n    if (_.isEmpty(args)) {\n        return callback(null, possibleArguments);\n    }\n\n    var replacements = [];\n    var lastArg = _.last(args);\n    if (args.length === 1) {\n        // If there is only one argument, we just try and auto complete one of the possible flags\n        replacements = _.filter(possibleArguments, function(possibleArgument) {\n            return (possibleArgument.indexOf(lastArg) === 0);\n        });\n    } else {\n        var secondLastArg = args[args.length - 2];\n        if (secondLastArg === '--log-level') {\n            // If we are choosing a log level, we offer up potential log levels for the value\n            replacements = _.filter(possibleLogLevels, function(possibleLogLevel) {\n                return (possibleLogLevel.indexOf(lastArg) === 0);\n            });\n        } else {\n            // We are not giving a flag value, so offer up another flag\n            replacements = _.filter(possibleArguments, function(possibleArgument) {\n                return (possibleArgument.indexOf(lastArg) === 0);\n            });\n        }\n    }\n\n    return callback(null, replacements);\n}\n```\n\n## License\n\nCopyright (c) 2014 Branden Visser\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"mrvisser","email":"mrvisser@gmail.com"}],"time":{"modified":"2022-06-26T09:16:20.517Z","created":"2014-04-21T20:40:54.337Z","0.0.2":"2014-04-21T20:40:57.063Z","0.0.3":"2014-04-21T21:00:31.667Z","0.0.4":"2014-04-21T21:47:55.238Z","0.0.5":"2014-05-03T13:33:56.079Z","0.1.0":"2014-05-25T21:38:16.721Z","0.2.0":"2014-05-25T22:08:17.550Z","0.2.1":"2014-05-25T22:26:38.309Z","0.2.2":"2014-05-25T22:50:25.081Z","0.2.3":"2014-11-29T13:36:07.460Z","0.3.0":"2014-12-20T15:39:46.917Z","0.4.0":"2021-06-22T13:26:58.192Z"},"readmeFilename":"README.md","homepage":"https://github.com/mrvisser/node-readcommand","repository":{"type":"git","url":"git://github.com/mrvisser/node-readcommand.git"},"author":{"name":"Branden Visser","email":"mrvisser@gmail.com"},"bugs":{"url":"https://github.com/mrvisser/node-readcommand/issues"},"license":"MIT","keywords":["arguments","argv","command","commands","parse","shell"]}