New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cli-interact

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-interact - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

55

index.js

@@ -33,2 +33,56 @@ //==============================

function getChoice (title, choices, opts) {
var answer;
var flagAllowNoAnswer;
var flagReturnNumber;
var i;
var numChoices = choices.length;
var parts = ['Select ', title, ' ('];
var queryText;
var str;
var temp;
var value;
if (opts) {
if (opts.allowNoAnswer) {
flagAllowNoAnswer = true;
}
if (opts.returnNumber) {
flagReturnNumber = true;
}
}
for (i = 1; i <= numChoices; i += 1) { // display 1 based to user
parts.push(i);
parts.push('=');
parts.push(choices[i - 1]); // choices array is 0-based
parts.push('; ');
}
parts.pop(); // get rid of trailing ';'
parts.push(') ?');
queryText = parts.join('');
while (true) {
answer = readlineSync.question(queryText);
if (answer === "\u0003") {
// Ctl-C
process.exit();
} else if (flagAllowNoAnswer && (answer === '')) {
return answer;
} else {
value = parseInt(answer, 10);
if ((value >= 1) && (value <= numChoices)) {
value -= 1; // user input is 1-based; choices array is 0-based
if (flagReturnNumber) {
return value;
} else {
return choices[value];
}
}
}
}
}
function getChoiceByChar (title, choices, flagAllowNoAnswer) {

@@ -140,2 +194,3 @@ var answer;

getChar : getChar
, getChoice : getChoice
, getChoiceByChar : getChoiceByChar

@@ -142,0 +197,0 @@ , getInteger : getInteger

2

package.json
{
"name": "cli-interact",
"version": "0.1.6",
"version": "0.1.7",
"title": "cli interact",

@@ -5,0 +5,0 @@ "description": "Simple helper tools for interacting synchronously with user at command line",

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