Skip to content

Commit

Permalink
add examples/terminal-link.js
Browse files Browse the repository at this point in the history
  • Loading branch information
starpit committed Apr 25, 2022
1 parent 4644d33 commit 1ae02db
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions packages/inquirer/examples/terminal-link.js
@@ -0,0 +1,26 @@
/**
* terminal-link example. We expect no odd line breaks.
*/

'use strict';
const inquirer = require('..');
const terminalLink = require('terminal-link')

/** Note: you will need a compatible terminal to see the rendered links. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda */
/** For screenshots of the expected behavior, see https://github.com/SBoudrias/Inquirer.js/pull/1106 */

inquirer
.prompt([
{
type: 'list',
name: 'size',
message: 'What size do you need?',
choices: ['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro which is truly and surely the ' + terminalLink('very very very very very very smallest', 'https://www.google.com/search?q=very+very+very+very+very+very+very+very+very+very+long')],
filter(val) {
return val.toLowerCase();
},
},
])
.then((answers) => {
console.log(JSON.stringify(answers, null, ' '));
});
3 changes: 2 additions & 1 deletion packages/inquirer/package.json
Expand Up @@ -26,7 +26,8 @@
"mocha": "^9.2.2",
"mockery": "^2.1.0",
"nyc": "^15.0.0",
"sinon": "^13.0.1"
"sinon": "^13.0.1",
"terminal-link": "^2.1.1"
},
"scripts": {
"test": "nyc mocha test/**/* -r ./test/before",
Expand Down

0 comments on commit 1ae02db

Please sign in to comment.