Created
April 28, 2016 17:23
-
-
Save geddski/c42feb364f3c671d22b6390d82b8af8f to your computer and use it in GitHub Desktop.
workaround for inquirer list type not working in windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Abstraction around multichoice questions that works in windows, despite https://github.com/nodejs/node/issues/5384 | |
* Uses arrow keys for non-windows and number selection for windows | |
*/ | |
var inquirer = require("inquirer"); | |
var isWindows = /^win/.test(process.platform); | |
module.exports = function(questions) { | |
if (!isWindows) { | |
return questions; | |
} | |
else { | |
questions.type = 'rawlist'; | |
return questions; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inquirer.prompt([ | |
multichoice({ | |
type: 'list', | |
message: 'select a starter', | |
name: 'starter', | |
choices: ['hello world', 'manifest only'] | |
}) | |
], function(answers){ | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment