Socket
Socket
Sign inDemoInstall

@rebel-framework/terminal

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.4 to 0.3.5

build/program.d.ts

1

build/input.d.ts

@@ -0,1 +1,2 @@

export declare function setRawMode(value: boolean): void;
export declare function input(): Promise<string>;

@@ -2,0 +3,0 @@ export declare function ask(question: string, defaultAnswer?: string): Promise<string>;

21

build/input.js

@@ -10,2 +10,3 @@ "use strict";

exports.input = input;
exports.setRawMode = setRawMode;
var _enums = require("./enums");

@@ -17,2 +18,8 @@ var output = _interopRequireWildcard(require("./output"));

const stdin = process.stdin;
function setRawMode(value) {
const tty = stdin;
if (tty && tty.isTTY && tty.setRawMode) {
tty.setRawMode(value);
}
}
function input() {

@@ -31,6 +38,3 @@ return new Promise(resolve => {

const answer = (await input()).trim();
if (answer === '') {
return defaultAnswer;
}
return answer;
return answer || defaultAnswer || '';
}

@@ -41,9 +45,6 @@ async function confirm(question, defaultAnswer) {

const answer = (await input()).trim().toLowerCase();
if (answer === '') {
return defaultAnswer !== undefined ? defaultAnswer : false;
}
return answer.startsWith('y');
return answer ? answer.startsWith('y') : defaultAnswer || false;
}
async function choice(question, choices) {
stdin.setRawMode(true);
setRawMode(true);
stdin.setEncoding('utf8');

@@ -70,3 +71,3 @@ let selectedIndex = 0;

} else if (char === _enums.TerminalKey.Enter) {
stdin.setRawMode(false);
setRawMode(false);
stdin.removeListener('data', keyListener);

@@ -73,0 +74,0 @@ resolve(choices[selectedIndex]);

@@ -16,2 +16,3 @@ "use strict";

var _ansii = require("./ansii");
var _program = require("./program");
const stdout = process.stdout;

@@ -42,7 +43,7 @@ function setRawMode(value) {

line((0, _styles.backgroundRed)(message));
process.exit(1);
(0, _program.exit)(1);
}
function success(message = 'Success') {
line((0, _styles.bold)((0, _styles.green)(message)));
process.exit(0);
(0, _program.exit)(0);
}
{
"name": "@rebel-framework/terminal",
"version": "0.3.4",
"version": "0.3.5",
"private": false,

@@ -5,0 +5,0 @@ "description": "Rebel Framework terminal",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc