{"id":15592016,"url":"https://github.com/derhuerst/prompt-skeleton","last_synced_at":"2025-04-15T05:02:58.652Z","repository":{"id":57159437,"uuid":"55648758","full_name":"derhuerst/prompt-skeleton","owner":"derhuerst","description":"A consistent behavior for CLI prompts.","archived":false,"fork":false,"pushed_at":"2022-01-28T19:58:51.000Z","size":47,"stargazers_count":14,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T21:36:59.306Z","etag":null,"topics":["cli","prompt"],"latest_commit_sha":null,"homepage":"https://github.com/derhuerst/prompt-skeleton","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derhuerst.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-06T23:37:27.000Z","updated_at":"2023-12-28T00:53:25.000Z","dependencies_parsed_at":"2022-09-08T11:03:42.074Z","dependency_job_id":null,"html_url":"https://github.com/derhuerst/prompt-skeleton","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fprompt-skeleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fprompt-skeleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fprompt-skeleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fprompt-skeleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derhuerst","download_url":"https://codeload.github.com/derhuerst/prompt-skeleton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923766,"owners_count":21183953,"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","prompt"],"created_at":"2024-10-02T23:52:55.133Z","updated_at":"2025-04-15T05:02:58.635Z","avatar_url":"https://github.com/derhuerst.png","language":"JavaScript","funding_links":["https://github.com/sponsors/derhuerst"],"categories":[],"sub_categories":[],"readme":"# prompt-skeleton\n\nThis project aims to bring a **consistent behavior to CLI apps**.\n\nUse [`cli-prompter`](https://github.com/ahdinosaur/cli-prompter) if you want to have batteries included or if you want to chain prompts.\n\n[![npm version](https://img.shields.io/npm/v/prompt-skeleton.svg)](https://www.npmjs.com/package/prompt-skeleton)\n[![dependency status](https://img.shields.io/david/derhuerst/prompt-skeleton.svg)](https://david-dm.org/derhuerst/prompt-skeleton#info=dependencies)\n![ISC-licensed](https://img.shields.io/github/license/derhuerst/prompt-skeleton.svg)\n[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)\n[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst)\n\nInstead of letting prompts parse user input by themselves, *prompt-skeleton* provides a [standard set of actions like `submit`](#actions), which prompts can act on by exposing methods. The key bindings are [readline](https://de.wikipedia.org/wiki/GNU_readline)-inspired.\n\n\n## Projects using `prompt-skeleton`\n\nPrompts:\n\n- [`sms-cli`](https://github.com/derhuerst/sms-cli)\n- [`date-prompt`](https://github.com/derhuerst/date-prompt)\n- [`mail-prompt`](https://github.com/derhuerst/mail-prompt)\n- [`multiselect-prompt`](https://github.com/derhuerst/multiselect-prompt)\n- [`number-prompt`](https://github.com/derhuerst/number-prompt)\n- [`range-prompt`](https://github.com/derhuerst/range-prompt)\n- [`select-prompt`](https://github.com/derhuerst/select-prompt)\n- [`text-prompt`](https://github.com/derhuerst/text-prompt)\n- [`tree-select-prompt`](https://github.com/derhuerst/tree-select-prompt)\n- [`cli-autocomplete`](https://github.com/derhuerst/cli-autocomplete)\n- [`switch-prompt`](https://github.com/derhuerst/switch-prompt)\n\nOther command line interfaces:\n\n- [`really-basic-chat-ui`](https://github.com/derhuerst/really-basic-chat-ui)\n- [`command-irail`](https://github.com/iRail/command-irail)\n- [`cli-2048`](https://github.com/derhuerst/cli-2048)\n- [`cli-minesweeper`](https://github.com/derhuerst/cli-minesweeper)\n- [`tiny-cli-editor`](https://github.com/derhuerst/tiny-cli-editor)\n\n\n## Installing\n\n```\nnpm install prompt-skeleton\n```\n\n\n## Usage\n\n```js\nwrap(prompt) // Promise\n```\n\nTo render to screen, [`write`](https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback) to `prompt.out`. Because `prompt.out` is a [`ansi-diff-stream`](https://www.npmjs.com/package/ansi-diff-stream#usage), you can also clear the screen manually be calling `prompt.out.clear()`.\n\n### Actions\n\nYou can process any of these actions by exposing a method `prompt[action]`.\n\n- `first`/`last` – move to the first/last letter/digit\n- `left`/`right`\n- `up`/`down`\n- `next` - for tabbing\n- `delete` – remove letter/digit left to the cursor\n- `space`\n- `submit` – success, close the prompt\n- `abort` – failure, close the prompt\n- `reset`\n\n### Example\n\nThis renders a prompt that lets you pick a number.\n\n```js\nconst wrap = require('prompt-skeleton')\n\nconst prompt = wrap({\n\tvalue: 0,\n\tup: function () {\n\t\tthis.value++\n\t\tthis.render()\n\t},\n\tdown: function () {\n\t\tthis.value--\n\t\tthis.render()\n\t},\n\trender: function () {\n\t\tthis.out.write(`The value is ${this.value}.`)\n\t}\n})\n\nprompt\n.then((val) =\u003e {\n\t// prompt succeeded, do something with the value\n})\n.catch((val) =\u003e {\n\t// prompt aborted, do something with the value\n})\n```\n\n\n## Contributing\n\nIf you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/prompt-skeleton/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fprompt-skeleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderhuerst%2Fprompt-skeleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fprompt-skeleton/lists"}