{"id":20139056,"url":"https://github.com/threeletters/cli-gui2","last_synced_at":"2025-06-10T10:08:46.003Z","repository":{"id":57200369,"uuid":"75685266","full_name":"ThreeLetters/CLI-GUI2","owner":"ThreeLetters","description":"Beautiful and functional console interface. Quickly create user-friendly interfaces. (Works over SSH)","archived":false,"fork":false,"pushed_at":"2018-01-11T16:59:22.000Z","size":66,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-11T05:47:39.883Z","etag":null,"topics":["cli-gui","nodejs","npm-package"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThreeLetters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-06T02:11:30.000Z","updated_at":"2025-04-04T06:30:34.000Z","dependencies_parsed_at":"2022-09-16T15:01:03.252Z","dependency_job_id":null,"html_url":"https://github.com/ThreeLetters/CLI-GUI2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThreeLetters%2FCLI-GUI2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThreeLetters%2FCLI-GUI2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThreeLetters%2FCLI-GUI2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThreeLetters%2FCLI-GUI2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThreeLetters","download_url":"https://codeload.github.com/ThreeLetters/CLI-GUI2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThreeLetters%2FCLI-GUI2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259053525,"owners_count":22798438,"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":["cli-gui","nodejs","npm-package"],"created_at":"2024-11-13T21:43:49.236Z","updated_at":"2025-06-10T10:08:45.983Z","avatar_url":"https://github.com/ThreeLetters.png","language":"JavaScript","readme":"# CLI-GUI2\n![cligui](https://cloud.githubusercontent.com/assets/13282284/24179552/2f214a24-0e86-11e7-8e91-ba859d606799.png)\n\nCLI-GUI - but much better. Graphical interface in command line.\n\n# Features\n\n1. List\n2. Checklist\n3. Search\n4. Table\n5. Prompt\n6. Guided prompt\n7. Log\n8. Terminal\n9. Box\n10. Editor\n\n\n# Documentation\n## Installation\n\u003e npm install cligui2\n\n## Usage\n```js\nvar CliGui = require('cligui2');\nvar interface = new CliGui();\n```\n\n#### interface.stop - Stop interface\nThis stops the interface completely\n\n#### interface.done - Remove layer\nUsed to remove \"layers\".\n\n#### interface.reset - Reset interface\nResets interface\n\n#### interface.addListener\nArguments: target,function\n\n\nAdds a listener to a target\n\n\nAvailable targets:\n1. key - Key presses\n\n#### interface.removeListener\nArguments: target,function\n\n\nRemoves a listener from a target\n\n#### interface.clearListeners\nArguments: target\n\n\nclears listeners from a target\n\n\n#### interface.list - List items\nArguments: title,items,call\n\nThe list function is very flexible. It can be called in four different ways.\n\n1. Options argument as an array of strings, call argument a function\n2. Options argument as an array of strings, call argument as an array of functions\n3. Options argument as an array of objects\n4. Options argument as an object\n\nExample:\n\n```js\ninterface.list(\"This is a list\",[\"a\",\"b\",\"c\",\"d\"],function(main,chosen) {\n\n})\n\ninterface.list(\"Another way\",[\"a\",\"b\",\"c\"],[\n  function(main) {},\n  function(main) {},\n  function(main) {}\n])\n\ninterface.list(\"Again Another way\",[\n  {\n    name: \"a\",\n    call: function(main) {}\n  },\n  {\n    name: \"b\",\n    call: function(main) {}\n  }\n])\n\ninterface.list(\"The fourth way\",{\n  a: function(main) {},\n  b: function(main) {},\n  c: function(main) {}\n})\n\n```\n\n\u003cimg width=\"562\" alt=\"List\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178816/d95eecf8-0e81-11e7-9eb4-a74521c11f85.png\"\u003e\n\n#### interface.checklist - List items as a checklist\nArguments: title,items,call\n\n\nThe checklist function is also as flexible as the list function. For usage, please refer to the list documentation. A option can also be checked on by default. To do so please set `checked` to true.\n\n\nExample:\n\n```js\ninterface.checklist(\"A is checked on by default\",[\n  {\n    name: \"a\",\n    checked: true,\n    call: function(main) {}\n  },\n  {\n    name: \"b\",\n    call: function(main) {}\n  }\n])\n```\n\n\u003cimg width=\"562\" alt=\"Checklist\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178825/e41bba18-0e81-11e7-8513-520c9ba1709e.png\"\u003e\n\n#### interface.search - List items as a searchable list\nArguments: title,items,call\n\n\nUsage is same as the usage for the List function\n\n\u003cimg width=\"562\" alt=\"Search\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178826/e8bd5450-0e81-11e7-8ffd-dd07606a8366.png\"\u003e\n\n#### interface.table - List items as a table\nArguments: title,data\n\n\nData is an object\n\n\nExample:\n```js\ninterface.table(\"This is a table\",{\n  thead: [\"a\",\"b\",\"c\"], // this is the sticky at the top\n  data: [[\"hello\",\"this\",\"is\"],[\"a\",\"cool\",\"test\"],[\"tables\",\"are\",\"fun\"], // the contents of the table\n  sizes: [8,8,8], // optional: Sets the size for each column\n  call: function(main,chosen) { // the callback\n  \n  }\n})\n```\n\n\u003cimg width=\"562\" alt=\"Table\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178827/eca5d9e8-0e81-11e7-8f9a-ab87134852ab.png\"\u003e\n\n#### interface.prompt - Prompt the user (text input)\nArguments: title,shadow,call\n\n\nThe prompt funcion prompts the user for a text input. \n\n\nExample:\n```js\ninterface.prompt(\"this is a prompt\",\"type something\",function(main,output) {\n\n})\n```\n\n\u003cimg width=\"562\" alt=\"Prompt\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178836/f6941e1a-0e81-11e7-8540-319f84b751a5.png\"\u003e\n#### interface.gprompt - Guided prompt\nArguments: title,shadow,options,call\n\n\nThe guided prompt function allows for a user-guiding prompt system\n\n\nExample:\n```js\nvar options = [\n  {\n    name: \"hello\",\n    description: \"Hello world\", // optional\n    options: [ // optional, sets arguments (ex: hello [arg1])\n      {\n      name: \"arg1\",\n      options: [\"a\",\"b\",\"c\"], // optional, sets selectable options for the argument\n      description: \"argument 1\" // optional\n      }  \n    ]\n  },\n  {\n  name: \"hello_again\" // spaces are not allowed\n  }\n]\ninterface.gprompt(\"this is a guided prompt\",\"type something\",options,function(main,output) {\n\n})\n```\n\n\u003cimg width=\"562\" alt=\"Guided prompt 1\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178838/fa71cc30-0e81-11e7-9bc4-b5f516544da1.png\"\u003e\n\n\u003cimg width=\"562\" alt=\"Guided prompt 2\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178843/ff229b2e-0e81-11e7-83a2-206a7634c40a.png\"\u003e\n#### interface.log - Display\nArguments: title\n\n\nReturns: logger\n\n\nFunctions:\n1. logger.log(string) - log string\n2. logger.slow(string,time,callback) - log string with typing animation\n3. logger.clear() - clear display\n4. logger.clearRow() - clear recent row\n\n\nExample:\n```js\nvar logger = interface.log(\"this is a log display\")\nlogger.log(\"This is logged onto the display\")\n```\n\n\u003cimg width=\"562\" alt=\"Log\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178844/030df062-0e82-11e7-9ed1-f414041e4b7e.png\"\u003e\n\n#### interface.terminal - Terminal\nArguments: title,startchar,callback\n\n\nReturns: logger\n\n\nFunctions:\n1. logger.log(string) - log string\n2. logger.slow(string,time,callback) - log string with typing animation\n3. logger.clear() - clear display\n4. logger.clearRow() - clear recent row\n\n\nExample:\n```js\nvar logger = interface.terminal(\"this is a terminal\",\"\u003e\",function(main,output) {\n\n})\nlogger.log(\"This is logged onto the display\")\n```\n\n\u003cimg width=\"562\" alt=\"Terminal\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178851/10672db4-0e82-11e7-9f58-9310c690c251.png\"\u003e\n\n#### interface.box - Popup box\nArguments: x,y,width,height,content,options,call\n\n\nExample: \n```js\nvar logger = interface.log(\"this is a log display\")\nfunction onKey(key) {\nif (key == \"ESC\") {\ninterface.box(-20,-3,40,6,\"Exit?\",{\nyes: function(m) {\nm.done(); // Removes box. BTW, m === interface\nm.done(); // removes log\n},\nno: function(m) {\nm.done(); // remove box\n}\n})\n}}\n\n\ninterface.addListener(\"key\",onKey); // add keypress listener\n\nlogger.log(\"This is logged onto the display\")\n```\n\n#### interface.editor - File editor\nArguments: file,callback\n\n\nExample:\n\n```js\ninterface.editor(\"./path/to/something.txt\",function(main,file_contents,saved?) {\n\n})\n```\n\u003cimg width=\"562\" alt=\"Editor\" src=\"https://cloud.githubusercontent.com/assets/13282284/24178853/13c5d49c-0e82-11e7-9d4d-685304728e3e.png\"\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthreeletters%2Fcli-gui2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthreeletters%2Fcli-gui2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthreeletters%2Fcli-gui2/lists"}