
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
prompt-sort
Advanced tools
Prompt that allows the user to re-order items in a list of choices.
Re-order choices
Use shift+up or shift+down to re-order list items.

Customize rendering
(you can do this kind of customization with any prompt)

Heads up!
The colors used in the example were added just for that example. See how that works in examples/prompt.js.
var Prompt = require('prompt-sort');
var prompt = new Prompt({
name: 'colors',
message: 'Sort colors from most to least favorite',
choices: [
'green',
'red',
'yellow'
]
});
// promise
prompt.run()
.then(function(answer) {
console.log(answer);
});
// or async
prompt.ask(function(answer) {
console.log(answer);
});
Register as a plugin with enquirer:
var Enquirer = require('enquirer');
var enquirer = new Enquirer();
enquirer.register('readme', require('prompt-sort'));
Enquirer supports both the declarative inquirer-style question format and a functional format using the .question method:
Declarative format
Questions can be defined as an array of objects, or a single question object:
var questions = [
{
type: 'sort', // <= define the prompt "type"
name: 'colors',
message: 'Sort colors from most to least favorite',
choices: [
'green',
'red',
'yellow'
]
}
];
enquirer.ask(questions)
.then(function(answers) {
console.log(answers)
});
Expressive format
Functional style questions.
enquirer.question('colors', {
type: 'sort',
message: 'Sort colors from most to least favorite',
choices: [
'green',
'red',
'yellow'
]
});
enquirer.ask(['colors'])
.then(function(answers) {
console.log(answers)
});
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running 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:
$ npm install && npm test
Brian Woodward
Copyright © 2017, Brian Woodward. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on June 05, 2017.
FAQs
Prompt that allows the user to re-order items in a list of choices.
We found that prompt-sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.