{"action":"created","issue":{"url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/446","repository_url":"https://api.github.com/repos/SBoudrias/Inquirer.js","labels_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/446/labels{/name}","comments_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/446/comments","events_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/446/events","html_url":"https://github.com/SBoudrias/Inquirer.js/issues/446","id":188353360,"number":446,"title":"create alias for choices","user":{"login":"ORESoftware","id":11139560,"avatar_url":"https://avatars.githubusercontent.com/u/11139560?v=3","gravatar_id":"","url":"https://api.github.com/users/ORESoftware","html_url":"https://github.com/ORESoftware","followers_url":"https://api.github.com/users/ORESoftware/followers","following_url":"https://api.github.com/users/ORESoftware/following{/other_user}","gists_url":"https://api.github.com/users/ORESoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/ORESoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORESoftware/subscriptions","organizations_url":"https://api.github.com/users/ORESoftware/orgs","repos_url":"https://api.github.com/users/ORESoftware/repos","events_url":"https://api.github.com/users/ORESoftware/events{/privacy}","received_events_url":"https://api.github.com/users/ORESoftware/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-09T21:11:08Z","updated_at":"2016-11-12T07:13:41Z","closed_at":"2016-11-12T07:13:41Z","body":"So I have this code:\r\n\r\n\r\n```js\r\nconst secondSetOfQuestions = [\r\n  {\r\n    type: 'list',\r\n    name: 'action',\r\n    message: 'What would you like to do?',\r\n    default: 'Run single test',\r\n    choices: [\r\n      'Run single test',\r\n      'Run multiple tests',\r\n      'Run tests with test coverage (Istanbul)',\r\n    ]\r\n  }\r\n];\r\n\r\ninquirer.prompt(firstSetOfQuestions).then(function (respuestas) {\r\n\r\n  console.log('Respuestas => ', respuestas);\r\n\r\n  if (respuestas.action === 'Generate a valid Suman terminal command') {\r\n    return inquirer.prompt(secondSetOfQuestions).then(function (answers) {\r\n            // do something\r\n    })\r\n  }\r\n\r\n}).catch(function (err) {\r\n  console.error(err.stack || err);\r\n});\r\n```\r\n\r\n*but* is there a way to do something like this:\r\n\r\n```js\r\nconst secondSetOfQuestions = [\r\n  {\r\n    type: 'list',\r\n    name: 'action',\r\n    message: 'What would you like to do?',\r\n    default: 'Run single test',\r\n    choices: [\r\n      {  \r\n        value:   'Run single test',\r\n       alias: 'a'\r\n      },\r\n     {  \r\n        value:   'Run multiple tests',\r\n       alias: 'b'\r\n      },\r\n      {  \r\n        value:    'Run tests with test coverage (Istanbul)',\r\n       alias: 'c'\r\n      }\r\n    ]\r\n\r\n  }\r\n];\r\n```\r\n\r\n....if I can use aliases, then I can do more convenient things, like below:\r\n\r\n```js\r\ninquirer.prompt(firstSetOfQuestions).then(function (respuestas) {\r\n\r\n  console.log('Respuestas => ', respuestas);\r\n\r\n  if (respuestas.action === 'Some value') {\r\n    return inquirer.prompt(secondSetOfQuestions).then(function (answers) {\r\n                return require('./subdir/' + answers.action);   // action = a,b, or c\r\n    })\r\n  }\r\n\r\n}).catch(function (err) {\r\n  console.error(err.stack || err);\r\n});\r\n```\r\n\r\nas you can see, I am using directory names, and requiring directories to branch my code logic, but it will be less convenient to name a directory:\r\n\r\n 'Run tests with test coverage (Istanbul)'\r\n\r\nI would prefer to name the directory:\r\n\r\n'a'\r\n\r\nLet me know! thanks\r\n"},"comment":{"url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/comments/260106686","html_url":"https://github.com/SBoudrias/Inquirer.js/issues/446#issuecomment-260106686","issue_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/446","id":260106686,"user":{"login":"SBoudrias","id":923865,"avatar_url":"https://avatars.githubusercontent.com/u/923865?v=3","gravatar_id":"","url":"https://api.github.com/users/SBoudrias","html_url":"https://github.com/SBoudrias","followers_url":"https://api.github.com/users/SBoudrias/followers","following_url":"https://api.github.com/users/SBoudrias/following{/other_user}","gists_url":"https://api.github.com/users/SBoudrias/gists{/gist_id}","starred_url":"https://api.github.com/users/SBoudrias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SBoudrias/subscriptions","organizations_url":"https://api.github.com/users/SBoudrias/orgs","repos_url":"https://api.github.com/users/SBoudrias/repos","events_url":"https://api.github.com/users/SBoudrias/events{/privacy}","received_events_url":"https://api.github.com/users/SBoudrias/received_events","type":"User","site_admin":false},"created_at":"2016-11-12T07:13:41Z","updated_at":"2016-11-12T07:13:41Z","body":"It is documented here with the `choice` key https://github.com/SBoudrias/Inquirer.js#question"}}
{"actor":{"display_login":"SBoudrias"}}