Socket
Socket
Sign inDemoInstall

inquirer

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

3

lib/objects/choices.js

@@ -99,2 +99,5 @@ 'use strict';

// Expose usual Array methods
Choices.prototype.indexOf = function () {
return this.choices.indexOf.apply(this.choices, arguments);
};
Choices.prototype.forEach = function () {

@@ -101,0 +104,0 @@ return this.choices.forEach.apply(this.choices, arguments);

4

lib/prompts/checkbox.js

@@ -99,3 +99,4 @@ /**

var choicesStr = renderChoices(this.opt.choices, this.pointer);
message += "\n" + this.paginator.paginate(choicesStr, this.pointer);
var indexPosition = this.opt.choices.indexOf(this.opt.choices.getChoice(this.pointer));
message += "\n" + this.paginator.paginate(choicesStr, indexPosition, this.opt.pageSize);
}

@@ -173,3 +174,2 @@

/**

@@ -176,0 +176,0 @@ * Function for rendering checkbox choices

@@ -83,3 +83,3 @@ /**

var choicesStr = renderChoices(this.opt.choices, this.selectedKey);
message += this.paginator.paginate(choicesStr, this.selectedKey);
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
message += "\n Answer: ";

@@ -86,0 +86,0 @@ }

@@ -97,3 +97,4 @@ /**

var choicesStr = listRender(this.opt.choices, this.selected );
message += "\n" + this.paginator.paginate(choicesStr, this.selected);
var indexPosition = this.opt.choices.indexOf(this.opt.choices.getChoice(this.selected));
message += "\n" + this.paginator.paginate(choicesStr, indexPosition, this.opt.pageSize);
}

@@ -100,0 +101,0 @@

@@ -96,3 +96,3 @@ /**

var choicesStr = renderChoices(this.opt.choices, this.selected);
message += this.paginator.paginate(choicesStr, this.selected);
message += this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
message += "\n Answer: ";

@@ -99,0 +99,0 @@ }

@@ -17,4 +17,4 @@ 'use strict';

Paginator.prototype.paginate = function (output, active) {
var pageSize = 7;
Paginator.prototype.paginate = function (output, active, pageSize) {
var pageSize = pageSize || 7;
var lines = output.split('\n');

@@ -21,0 +21,0 @@

@@ -46,8 +46,10 @@ 'use strict';

// current line.
if (rawPromptLine.length === cliWidth()) {
lines.splice(lines.length, 0, ' ');
var breakedLines = breakLines(lines);
var actualLines = _.flatten(breakedLines);
if (rawPromptLine.length % cliWidth() === 0) {
actualLines.push('');
}
this.rl.output.write(actualLines.join('\n'));
this.rl.output.write(lines.join('\n'));
/**

@@ -57,5 +59,2 @@ * Re-adjust the cursor at the correct position.

var breakedLines = breakLines(lines);
var actualLines = _.flatten(breakedLines);
var promptLineUpDiff = Math.floor(rawPromptLine.length / cliWidth()) - cursorPos.rows;

@@ -69,15 +68,7 @@ if (opt.cursor + promptLineUpDiff > 0) {

// Adjust cursor on the right
var rightPos = cursorPos.cols;
if (cursorPos.rows === 0) {
rightPos = Math.max(rightPos, rawPrompt.length);
}
// rightPos should never be further than the total line content size.
// If we changed the prompt and reset the rl.line, we want to reset our
// cursor at the beginning of the prompt.
if (rightPos > rawPromptLine.length && !this.rl.line) {
rightPos = rawPrompt.length;
}
util.right(this.rl, rightPos);

@@ -110,8 +101,15 @@

function breakLines(lines) {
// Break lines who're longuer than the cli width so we can gracefully handle line
// returns.
var regex = new RegExp('.{1,' + cliWidth() + '}', 'g');
// Break lines who're longuer than the cli width so we can normalize the natural line
// returns behavior accross terminals.
var width = cliWidth();
var regex = new RegExp(
'(?:(?:\\033\[[0-9;]*m)*.?){1,' + width + '}',
'g'
);
return lines.map(function (line) {
return stripAnsi(line).match(regex);
var chunk = line.match(regex);
// last match is always empty
chunk.pop();
return chunk || '';
});
}
{
"name": "inquirer",
"version": "0.11.0",
"version": "0.11.1",
"description": "A collection of common interactive command line user interfaces.",

@@ -5,0 +5,0 @@ "main": "lib/inquirer.js",

@@ -22,3 +22,3 @@ Inquirer.js

> **Note:** **`Inquirer.js`** provides the user interface, and the inquiry session flow. If you're searching for a full blown command line program utility, then check out [Commander.js](https://github.com/visionmedia/commander.js).
> **Note:** **`Inquirer.js`** provides the user interface, and the inquiry session flow. If you're searching for a full blown command line program utility, then check out [Commander.js](https://github.com/visionmedia/commander.js) or [Vorpal.js](https://github.com/dthree/vorpal).

@@ -72,3 +72,3 @@

- **default**: (String|Number|Array|Function) Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers.
- **choices**: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers.
- **choices**: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers.
Array values can be simple `strings`, or `objects` containing a `name` (to display in list), a `value` (to save in the answers hash) and a `short` (to display after selection) properties. The choices array can also contain [a `Separator`](#separator).

@@ -270,4 +270,5 @@ - **validate**: (Function) Receive the user input and should return `true` if the value is valid, and an error message (`String`) otherwise. If `false` is returned, a default error message is provided.

- Cygwin
- **Ubuntu**:
- Terminal
- **Linux (Ubuntu, openSUSE, Arch Linux, etc)**:
- gnome-terminal (Terminal GNOME)
- konsole

@@ -282,13 +283,13 @@

**Style Guide**
Please brief yourself on [Idiomatic.js](https://github.com/rwldrn/idiomatic.js) style guide with two space indent
**Style Guide**
Please brief yourself on [Idiomatic.js](https://github.com/rwldrn/idiomatic.js) style guide with two space indent
**Unit test**
Unit test are written in [Mocha](http://visionmedia.github.io/mocha/). Please add a unit test for every new feature or bug fix. `npm test` to run the test suite.
**Unit test**
Unit test are written in [Mocha](https://mochajs.org/). Please add a unit test for every new feature or bug fix. `npm test` to run the test suite.
**Documentation**
**Documentation**
Add documentation for every API change. Feel free to send corrections
or better docs!
or better docs!
**Pull Requests**
**Pull Requests**
Send _fixes_ PR on the `master` branch. Any new features should be send on the `wip`branch.

@@ -303,3 +304,3 @@

Copyright (c) 2012 Simon Boudrias (twitter: @vaxilart)
Copyright (c) 2015 Simon Boudrias (twitter: @vaxilart)
Licensed under the MIT license.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc