{"_id":"simple-terminal-menu","_rev":"11-121dd41ce519f8dad6a198aa284db7d0","name":"simple-terminal-menu","description":"A menu that is easier to use on the terminal than terminal-menu ","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"simple-terminal-menu","version":"1.0.0","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git@github.com:martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"terminal-menu":"^2.1.1","visualwidth":"^0.1.0","xtend":"^4.0.0"},"gitHead":"7c800d56f93dea945f88606713ce255ee4aa6854","_id":"simple-terminal-menu@1.0.0","_shasum":"8a06777a5cd53ddb2edef5e02ea988bcf8a4876c","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"leichtgewicht","email":"mh@leichtgewicht.at"},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"dist":{"shasum":"8a06777a5cd53ddb2edef5e02ea988bcf8a4876c","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-1.0.0.tgz","integrity":"sha512-srGcPZc6Z/hhyuL5pkqZKtugOSKIbxerbikuCQ5VVGCoCzPBosDWAU2KwF7Phlk6Ebb7ZG614B5GixDVGIaxqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9PQgMr9j50ZOoFH8YtzSBJvmFoqrxEJPDVM9BzG209AIgOlbVam09GiJsEcHxzFU1u0SWSkLuFR4bmBMXeexUxS4="}]},"directories":{}},"1.0.1":{"name":"simple-terminal-menu","version":"1.0.1","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"extended-terminal-menu":"^2.1.2","visualwidth":"^0.1.0","xtend":"^4.0.0"},"gitHead":"ca56aeb041d21f16fd170b569ecb5524b0655e31","_id":"simple-terminal-menu@1.0.1","_shasum":"d72d660bd86ba7fe87ee2d97286cfb53060e7b17","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"leichtgewicht","email":"mh@leichtgewicht.at"},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"dist":{"shasum":"d72d660bd86ba7fe87ee2d97286cfb53060e7b17","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-1.0.1.tgz","integrity":"sha512-mrDmct7W9gwGBpLtAHzLp2n4DpSm89Ml5r841ecfw3C/+oXd7QwowbM3S3XJDqKf4ntFfXNDilVQqs/4cFtrhQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfAZgXJDKDPXX7v0z2sw4opMBWhblpTH4Ra7Gad2Q0ZwIgdM1lWAmHfN5GURU2XzTOH0XfwQ8SxTzLVYYM3IZOm+U="}]},"directories":{}},"1.1.0":{"name":"simple-terminal-menu","version":"1.1.0","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"chalk":"^1.1.1","extended-terminal-menu":"^2.1.2","visualwidth":"^0.1.0","xtend":"^4.0.0"},"gitHead":"321acec0206a37e19d0aad2e52b088c185657e0b","_id":"simple-terminal-menu@1.1.0","_shasum":"c053e12c76cf93db219b4f027f2dbfa7af4c9e8d","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"leichtgewicht","email":"mh@leichtgewicht.at"},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"dist":{"shasum":"c053e12c76cf93db219b4f027f2dbfa7af4c9e8d","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-1.1.0.tgz","integrity":"sha512-d1bEuMhVtlNtpkwhZDZ/lKbxIhHoShdPmXC7wcrpLOvEe3McNzhHziGjJ8EGVH5kJdQcn9KPbfwcSVD8oGKRhA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4wdLsZ81lLQ+2SBpO3FqhVm6moxZ8VXTC1USbU5m2pAIgJ7jIdllOZ865V5/uQ1rz9nIxnl7JWc1W8D7qACERPtc="}]},"directories":{}},"1.1.1":{"name":"simple-terminal-menu","version":"1.1.1","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git@github.com:martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"chalk":"^1.1.1","extended-terminal-menu":"^2.1.2","visualwidth":"^0.1.0","xtend":"^4.0.0"},"gitHead":"aedd5be4b2096def21f7aa58dc8c5655ce27c010","_id":"simple-terminal-menu@1.1.1","_shasum":"572330de4f230fc1957a94b62a0cd28571002247","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"leichtgewicht","email":"mh@leichtgewicht.at"},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"dist":{"shasum":"572330de4f230fc1957a94b62a0cd28571002247","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-1.1.1.tgz","integrity":"sha512-BQGkJpsOUAnfbSmuaWXNg5nkIwr/LcIWMY980R2vDT/9Vo23jwlm7gfyyZEwlj+pLYDoISllgwsZQvobFRttzA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA+jLNrfd7k41jpjUJktxEvjOO+E63FvQELbqz1ajMRUAiAuSeOYXQFNDmg3omwfy8ehrEQ2ohs54jmGBcH60+gGYw=="}]},"directories":{}},"1.1.2":{"name":"simple-terminal-menu","version":"1.1.2","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"chalk":"^1.1.1","extended-terminal-menu":"^2.1.2","wcstring":"^2.1.0","xtend":"^4.0.0"},"gitHead":"b6b93c0be9c17ea15c5cd1ffdc4102db3b308b3f","_id":"simple-terminal-menu@1.1.2","_shasum":"b8204f4ac433e83be2f241fce2a5c24dafa17271","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"leichtgewicht","email":"martin.heidegger@gmail.com"},"dist":{"shasum":"b8204f4ac433e83be2f241fce2a5c24dafa17271","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-1.1.2.tgz","integrity":"sha512-/T8k0wvR+jYRB+9evN+OjJAschKIlmziFQ1W1hJ0RZXVWoUbk0/2GaWKX+nfcXh573HtjvEZE1pOZSU8CRMXWg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFKqNi7iMSXnGh3WFVE2kH19n6/CHOkulVRW8iks3WsuAiEA7cBOaKp/rwdbwy822fPzs0v9AuqwpNEf4x2qIBdrzeM="}]},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"directories":{}},"1.1.3":{"name":"simple-terminal-menu","version":"1.1.3","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"chalk":"^1.1.1","extended-terminal-menu":"^2.1.2","wcstring":"^2.1.0","xtend":"^4.0.0"},"gitHead":"f9a70af24072452a946b8d7df3034942c59e7113","_id":"simple-terminal-menu@1.1.3","_shasum":"6a9aa6b1c41df53fc0b020780c764dbcdec481ff","_from":".","_npmVersion":"3.9.0","_nodeVersion":"5.10.0","_npmUser":{"name":"leichtgewicht","email":"martin.heidegger@gmail.com"},"dist":{"shasum":"6a9aa6b1c41df53fc0b020780c764dbcdec481ff","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-1.1.3.tgz","integrity":"sha512-UxbdVZ2qKPq5AZ3ZxWvkiUZjn5glDgMh5uMjBYBenhXsp0WQOYGUJtz8DTwVcoEnCC6Mhwr33E4aFd6XNgxh5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOezF4fCUdMGXb1qExwZX4uBDU9Z/7z9xuCnIDppWQiwIgbkRdEoSBhWsNmGjB4mYgBJxY5ysWMQDXlxcJs5rLD0Q="}]},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/simple-terminal-menu-1.1.3.tgz_1463149742335_0.37650205404497683"},"directories":{}},"2.0.0":{"name":"simple-terminal-menu","version":"2.0.0","description":"A menu that is easier to use on the terminal than terminal-menu ","main":"simple-terminal-menu.js","scripts":{"test":"npm run test:lint && npm run test:typescript","test:lint":"standard","test:typescript":"npx -p typescript -p ts-node -c 'ts-node test/types.ts'"},"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/simple-terminal-menu.git"},"keywords":["menu","cli"],"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","dependencies":{"ansi-styles":"^4.2.1","extended-terminal-menu":"^3.0.3","wcstring":"^2.1.0"},"devDependencies":{"@types/node":"^14.6.0","standard":"^14.3.4"},"gitHead":"cda42fe63a679ae260de507ca0655826ae9edbdb","_id":"simple-terminal-menu@2.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-m9TpPbiYkHnq0FktmYpvcELiHFP7I9TF9hDxa37nv8CODKDHdCUxHoAa1krso3ULtAexhrlAI5UjEUA/DDbpNg==","shasum":"88cd413575675add498b3645b85d13b59ca1dfb1","tarball":"https://registry.npmjs.org/simple-terminal-menu/-/simple-terminal-menu-2.0.0.tgz","fileCount":10,"unpackedSize":19245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfP3hhCRA9TVsSAnZWagAAUJ4P/2ZNDxIKL/bO4iv4iASq\nZcbSOtME4SFZ/iACXzhYAPG23unZdKeffuWh3FXDYVq2sT8MKRQgKKtGXhgm\n6I4enaN7txnf1y9cVjUdxVhgODV2D/lZ62uCXW7VWFx1GAjBvvuisyzMzaLB\n1Agbgm7Gsz37QPA03whaPGbjPtT+VERwtSOh2OZgI5sKrciASFMaalPZMtp3\nhW/cdXFyFvRzSWtgKHaWaBnjqMdJ6VDU17eCdo5K0GbWSaYmGtAo6Hk17MSa\nnZeUtc2A5mLfpXOklaGbvkN98AdsMQHMY0r82qGvC6Gpsb0AgKfispRIYX7E\nfqCIypZcO+W8H7AyaAJCCFaF/S2stN2rvF0zlVHidjQ5Sm3QOuQxq6Fs57q2\nQARnRAHNvZ2G8ujKSEiLcGNNwRB1Cbt3y9QhBubRt+lCgm6pnrXC7C8zTn+g\nM0sfuzkgZECgQpIPGJn9AJaKNlAm2FAJIR92dsL7Ay/lCzQ3jDrY4tss2LpJ\nrIs9F877Bq+Dke+NY2ZPkX7hqmi1iS8SZDWRaqiRKdEV5XsIwVJa/xKZj+Hy\njKyPebWgT6k4r6cxKKNf6hhGgUpi5D7DEP3g91N96WDXC77/SzuhornKMq/g\nPVPiKmM8Odiu6ahfnzFtb6KvCCqlzvvdLicwYLXkGzD/t7pONqvdNIHm7lK/\n1cUG\r\n=fKx9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzftlK5eqL1RG0cygz5Rcz8saGGMoteBdzzmlSZm2rKwIhAMEXOuWcyHgPx9y4Gy8dXDyYI5VFZbUJ7wd71+H5OkaA"}]},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"_npmUser":{"name":"leichtgewicht","email":"martin.heidegger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simple-terminal-menu_2.0.0_1597995104603_0.9632549501239276"},"_hasShrinkwrap":false}},"readme":"# simple-terminal-menu\n\n[`terminal-menu`](https://github.com/substack/terminal-menu) does a good job for starting a menu but it is a bit tedious to set-up reliably for process.stdin / process.stdout and also for the use with double width characters.\n\nFor simply taking charge of the power this terminal menu offers a few things:\n\n## Automatically connects to process.stdin/stdout\nYou don't have to do that, it will just work :)\n\nYou can manually trigger start if you like using the `.autoStart: false` option and start it by hand:\n\n```javascript\nconst menu = new TerminalMenu({\n  autoStart: false\n})\n// Then start it manually\nmenu.start(process) // Optionally you can pass in a custom process here for testing.\n```\n\n## Markers\n`.add` gets an new signature\n\n```JavaScript\nconst label = 'hello' // will be aligned left\nconst marker = '(tm)' // (optional) will be aligned right\nconst handler = (label, marker) => {\n  // (optional) will be called in case the item is chosen\n}\nmenu.add(label, marker, handler)\n```\n\nWith this you can add entries that have a right-aligned marker text shown.\n\n## Menu Items\nYou can also use `.addItem` to use objects to add menu items.\n\n```JavaScript\nmenu.addItem({\n  label: 'hello', // will be aligned left\n  marker: '(tm)', // (optional) will be aligned right\n  handler: (label, index, item) => {\n    // (optional) will be called in case the item is chosen\n  }\n})\n```\n\n## Separators\nJust use ```.writeSeparator()``` to create a separator line.\n\n## Automatic truncating of entries\nIf an entry exceeds the width of the menu it will be truncated with `opts.truncator` or `...`\n\n## Writing of text\nSimilar like `.add` it supports `.writeLine` that allows you to write a text that is both left & right aligned.\n\n```JavaScript\n.writeLine(<left>[, <right>])\n```\n\n## tty Tests\nIf the terminal doesn't support TTY `new TerminalMenu` will just `null`!\n\n```js\nconst TerminalMenu = require('simple-terminal-menu')\nconst menu = new TerminalMenu()\nif (menu === null) {\n  console.log('interactive menu not supported')\n  process.exit(1)\n}\n```\n\n## Comfort functions\nTo write a nice title and subtitle the comfort functions `.writeTitle` and `.writeSubtitle` exist.\n\n## Factory\nIf you have several menus that need to look alike, you can use the factory. It is available via `require('simple-terminal-menu/factory')`.\n\n\n# Installation & Usage\nInstall it using npm\n\n```\nnpm install simple-terminal-menu --save\n```\n\nAnd then create a menu it in your code using\n\n```JavaScript\nconst TerminalMenu = require('../simple-terminal-menu')\n\nfunction showSelection(label, index, item) {\n  console.log(\"label: \" + label + \"; marker: \" + item.marker + \";\")\n}\n\nfunction mainMenu() {\n  const menu = new TerminalMenu({ // settings passed through to terminal-menu\n    width: 80,   // menu width in columns\n    x: 1,        // top-left corner x offset, default: 1\n    y: 1,        // top-left corner y offset, default: 1\n    fg: 'white', // foreground color, default: 'white'\n    bg: 'blue',  // background color, default: 'blue'\n    padding: {\n      left: 0    // left padding in columns\n      right: 0   // right padding in columns\n      top: 0     // top padding in rows\n      bottom: 0  // bottom padding in rows\n    },\n    selected: 0  // set the selected element by its index\n  })\n\n  if (menu === null) {\n    // In case the terminal is not interactive the result is null\n    console.log('terminal is not interactive')\n    return\n  }\n  menu.writeLine(\"My Menu\", \"(tm)\")\n  menu.writeSeparator()\n  menu.add(\"A\", \"[selected]\", showSelection)\n  menu.add(\"B\", showSelection)\n  menu.writeSeparator()\n  menu.add(\"open submenu\", subMenu)\n  menu.add(\"exit\", menu.close)\n}\n\nfunction subMenu() {\n  const menu = new TerminalMenu()\n  menu.writeLine(\"SubMenu\")\n  menu.writeSeparator()\n  menu.add(\"C\", \"[selected]\", showSelection)\n  menu.add(\"D\", showSelection)\n  menu.writeSeparator()\n  menu.add(\"cancel\", mainMenu)\n  menu.add(\"niceTitle\", nicelyTitledMenu)\n  menu.add(\"exit\", menu.close)\n}\n\nfunction nicelyTitledMenu() {\n  const menu = new TerminalMenu();\n  menu.writeTitle(\"Awesome window\")\n  menu.writeSubtitle(\"A little more colorful\")\n  menu.writeSeparator()\n  menu.add(\"cancel\", subMenu)\n  menu.add(\"factoryA\", factoryMenuA)\n  menu.add(\"exit\", menu.close)\n}\n\n\n// Options for the menu when created through the factory\nvar factoryMenuOptions = {} // Can be empty! the factory uses some sensible defaults!\n\n// Defaults for creating menu with the factory\nvar defaultFactoryOptions = {\n  title: \"Factory Title\",\n  // you could also specify `subtitle:`, menu & extras are not available.\n}\nvar factory = require('simple-terminal-menu/factory')(factoryMenuOptions, defaultFactoryOptions);\n\nfunction factoryMenuA() {\n  factory.create({\n    subtitle: \"factory-a\",\n    before: (menu) => {\n      // Do anything you like before menu/extras are added\n    }\n    menu: [{\n      label: \"E\",\n      handler: showSelection\n    }, {\n      label: \"F\",\n      handler: showSelection\n    }],\n    extras: [{\n        label: \"factoryB\",\n        handler: factoryMenuB\n      },{\n        label: \"cancel\",\n        handler: nicelyTitledMenu\n      }],\n    after: (menu) => {\n      // Do anything you like after menu/extras are added\n    }\n  })\n}\n\nfunction factoryMenuB() {\n  factory.create({\n    subtitle: \"factory-b\",\n    menu: [{\n        label: \"G\",\n        handler: showSelection\n      }],\n    extras: [{\n        label: \"factoryA\",\n        handler: factoryMenuA\n      },{\n        label: \"cancel\",\n        handler: nicelyTitledMenu\n      }]\n  });\n}\n\n\nmainMenu()\n```\n\n## License\n\n[MIT](./LICENSE)\n","maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"time":{"modified":"2022-06-26T19:54:46.327Z","created":"2015-04-13T20:20:42.484Z","1.0.0":"2015-04-13T20:20:42.484Z","1.0.1":"2015-09-16T12:51:37.061Z","1.1.0":"2015-09-17T01:29:59.381Z","1.1.1":"2015-09-21T12:53:14.455Z","1.1.2":"2016-01-31T18:17:25.294Z","1.1.3":"2016-05-13T14:29:05.539Z","2.0.0":"2020-08-21T07:31:44.744Z"},"homepage":"https://github.com/martinheidegger/simple-terminal-menu","keywords":["menu","cli"],"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/simple-terminal-menu.git"},"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"bugs":{"url":"https://github.com/martinheidegger/simple-terminal-menu/issues"},"license":"MIT","readmeFilename":"Readme.md","users":{"yuch4n":true}}