{"id":20206782,"url":"https://github.com/enquirer/prompt-sort","last_synced_at":"2025-08-02T21:39:03.303Z","repository":{"id":57331741,"uuid":"89761838","full_name":"enquirer/prompt-sort","owner":"enquirer","description":"This repository has been archived, use the built-in sort prompt in Enquirer instead.","archived":false,"fork":false,"pushed_at":"2017-06-05T04:06:22.000Z","size":1236,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T11:13:13.683Z","etag":null,"topics":["items","list","order","prompt","sort"],"latest_commit_sha":null,"homepage":"https://github.com/enquirer","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enquirer.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":"2017-04-29T03:41:42.000Z","updated_at":"2018-12-14T01:18:54.000Z","dependencies_parsed_at":"2022-09-05T10:10:26.602Z","dependency_job_id":null,"html_url":"https://github.com/enquirer/prompt-sort","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enquirer%2Fprompt-sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enquirer%2Fprompt-sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enquirer%2Fprompt-sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enquirer%2Fprompt-sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enquirer","download_url":"https://codeload.github.com/enquirer/prompt-sort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247940835,"owners_count":21022022,"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":["items","list","order","prompt","sort"],"created_at":"2024-11-14T05:26:02.895Z","updated_at":"2025-04-10T12:33:15.177Z","avatar_url":"https://github.com/enquirer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prompt-sort [![NPM version](https://img.shields.io/npm/v/prompt-sort.svg?style=flat)](https://www.npmjs.com/package/prompt-sort) [![NPM monthly downloads](https://img.shields.io/npm/dm/prompt-sort.svg?style=flat)](https://npmjs.org/package/prompt-sort) [![NPM total downloads](https://img.shields.io/npm/dt/prompt-sort.svg?style=flat)](https://npmjs.org/package/prompt-sort)\n\n\u003e Prompt that allows the user to re-order items in a list of choices.\n\n**Re-order choices**\n\nUse \u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003eup\u003c/kbd\u003e or \u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003edown\u003c/kbd\u003e to re-order list items.\n\n![prompt-sort example](https://raw.githubusercontent.com/enquirer/prompt-sort/master/docs/example-sort.gif)\n\n**Customize rendering**\n\n_(you can do this kind of customization with any prompt)_\n\n![prompt-sort customized rendering](https://raw.githubusercontent.com/enquirer/prompt-sort/master/docs/example-customized.gif)\n\n## Usage\n\n**Heads up!**\n\nThe colors used in the example were added just for that example. See how that works in [examples/prompt.js](examples/prompt.js).\n\n```js\nvar Prompt = require('prompt-sort');\nvar prompt = new Prompt({\n  name: 'colors',\n  message: 'Sort colors from most to least favorite',\n  choices: [\n    'green',\n    'red',\n    'yellow'\n  ]\n});\n\n// promise\nprompt.run()\n  .then(function(answer) {\n    console.log(answer);\n  });\n\n// or async\nprompt.ask(function(answer) {\n  console.log(answer);\n});\n```\n\n## Enquirer usage\n\nRegister as a plugin with [enquirer](http://enquirer.io):\n\n```js\nvar Enquirer = require('enquirer');\nvar enquirer = new Enquirer();\n\nenquirer.register('readme', require('prompt-sort'));\n```\n\n### Enquirer examples\n\n[Enquirer](http://enquirer.io) supports both the declarative inquirer-style question format and a functional format using the `.question` method:\n\n**Declarative format**\n\nQuestions can be defined as an array of objects, or a single question object:\n\n```js\nvar questions = [\n  {\n    type: 'sort', // \u003c= define the prompt \"type\"\n    name: 'colors',\n    message: 'Sort colors from most to least favorite',\n    choices: [\n      'green',\n      'red',\n      'yellow'\n    ]\n  }\n];\n\nenquirer.ask(questions)\n  .then(function(answers) {\n    console.log(answers)\n  });\n```\n\n**Expressive format**\n\nFunctional style questions.\n\n```js\nenquirer.question('colors', {\n  type: 'sort',\n  message: 'Sort colors from most to least favorite',\n  choices: [\n    'green',\n    'red',\n    'yellow'\n  ]\n});\n\nenquirer.ask(['colors'])\n  .then(function(answers) {\n    console.log(answers)\n  });\n```\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 05, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenquirer%2Fprompt-sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenquirer%2Fprompt-sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenquirer%2Fprompt-sort/lists"}