Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
autoComplete as ac,
getDetectedTerminal,
ScreenBufferHD,
ScreenBuffer,
Terminal
} from "terminal-kit";
import "node";
import * as fs from "fs";
new t.Rect({width: 4, height: 4});
// The term() function simply output a string to stdout, using current style
// output "Hello world!" in default terminal's colors
t.terminal("Hello world!\n");
// This output 'red' in red
term.red("red");
// This output 'bold' in bold
term.bold("bold");
// output 'mixed' using bold, underlined & red, exposing the style-mixing syntax
term.bold.underline.red("mixed");
// printf() style formatting everywhere:
// this will output 'My name is Jack, I'm 32.' in green
term.green("My name is %s, I'm %d.\n", "Jack", 32);
// Since v0.16.x, style markup are supported as a shorthand.
// Those two lines produce the same result.
term("My name is ")
.red("Jack")(" and I'm ")
.green("32\n");
const term = require('terminal-kit').terminal
const updateNotifier = require('update-notifier')
const pkg = require('../../package.json')
const version = pkg.engines.node
// Check if a new version is available
const notifier = updateNotifier({
pkg,
updateCheckInterval: 1000 * 60 * 60 * 24 // everyday for the moment
})
notifier.notify()
if (!semver.satisfies(process.version, version)) {
term.white('Bearer: ')
term.red(`Required node version ${version} not satisfied with current version ${process.version}.`)
term('\n')
process.exit(1)
}
(error: any, result: any) => {
if (result) {
term.green("'Yes' detected! Good bye!\n");
} else {
term.red("'No' detected, are you sure?\n");
question();
}
}
);
process.on('uncaughtException', err => {
terminal.red(`uncaughtException: ${err.message}\n`)
console.error(err.stack)
exit()
})
}
server.on( 'error' , ( error ) => {
if ( error.code === 'EACCES' ) {
term.red( "Error EACCES: opening port %i is forbidden.\n" , serverConf.port ) ;
term.red( "Please use the --port option to specify another port.\n" ) ;
}
else if ( error.code === 'EADDRINUSE' ) {
term.red( "Error EADDRINUSE: port %i is already used by another program on your system.\n" , serverConf.port ) ;
term.red( "Please use the --port option to specify another port.\n" ) ;
}
else {
term.red( error.toString() + '\n' ) ;
}
process.exit( 1 ) ;
} ) ;
} ;
server.on( 'error' , ( error ) => {
if ( error.code === 'EACCES' ) {
term.red( "Error EACCES: opening port %i is forbidden.\n" , serverConf.port ) ;
term.red( "Please use the --port option to specify another port.\n" ) ;
}
else if ( error.code === 'EADDRINUSE' ) {
term.red( "Error EADDRINUSE: port %i is already used by another program on your system.\n" , serverConf.port ) ;
term.red( "Please use the --port option to specify another port.\n" ) ;
}
else {
term.red( error.toString() + '\n' ) ;
}
process.exit( 1 ) ;
} ) ;
} ;
term.yesOrNo({ yes: ['y'], no: ['n', 'ENTER'] }, (error, result) => {
if (error) process.exit(error)
if (result) {
areYouSure()
} else {
term.red("'No' detected, backup your DB before cleanup!\n")
process.exit()
}
})
}
function outputError(error) {
if (typeof error !== 'undefined' && error.message) {
term.white('Error: ')
term.red(error.message)
term('\n')
}
}
emitter.on('start:failed', ({ error }) => {
term.red('An error occured')
term('\n')
term.white(' Error: ')
term.red(error)
term('\n')
})