Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
start();
term.slowTyping(
"What a wonderful world!\n",
{ flashStyle: term.brightWhite },
() => {}
);
// low level
term("My name is ")
.red("Jack")(" and I'm ")
.green("32\n");
term("My name is ^rJack^ and I'm ^g32\n");
term.noFormat.red("hello");
term.noFormat("hello");
// color methods with a second argument
term.color(1, "test");
term.darkColor(1, "test");
term.brightColor(1, "test");
term.color256(1, "test");
term.colorRgb(255, 0, 0, "test");
term.colorRgbHex("#ff0000", "test");
term.colorGrayscale(192, "test");
// bgColor methods with a second argument
term.bgColor(1, "test");
term(`We'll ask you some questions to create an initial settings configuration.\n\n`)
let conf: Config
while (true) {
conf = await askUser()
term.yellow(`\n${JSON.stringify(conf, null, 2)}`)
term(`\nIs this correct [Y/n]? `)
const correct = (await term.inputField().promise).trim().toLowerCase()
if (correct === '' || correct === 'yes' || correct === 'y') break
}
// create the ~/.chattervox dir, config.json, and keystore.json
init()
const ks: Keystore = new Keystore(conf.keystoreFile)
term(`\nGenerating ECDSA keypair...`)
const key: Key = ks.genKeyPair(conf.callsign)
await timeout(2000) // delay for dramatic effect, lol
term(`\nPublic Key: ^c${key.public}^\n`)
// signatures are created using a private key, but we don't want to include
// the private key in the config file, so instead we use the public key
// as the identifier, and then actually sign with the private key.
conf.signingKey = key.public
try {
save(conf)
term(`\nSettings saved to ${defaultConfigPath}\n`)
} catch (err) {
term(`\nError saving settings to ${defaultConfigPath}\n`)
term.processExit()
}
function resetTerminal() {
term.saveCursor();
term.moveTo(1, showStatus ? 2 : 1);
lineNum = 0;
term.eraseDisplayBelow();
var data = input.map(cropLine).map(highlightLine).join('\n');
data = data.replace(/(#\sCommands:[^]*?#\s*\n)/, '$1' + editorCommands.join('\n# ') + '\n#\n');
data = data.replace(/#\sx, exec.*\s*\n/, '');
data = data.replace(/#\sd, drop.*\s*\n/, '');
data = data.split('\n').slice(0, term.height - 1).join('\n');
status('Status');
term(data);
term.restoreCursor();
}
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
"use strict" ;
var term = require( 'terminal-kit' ).terminal ;
term( 'Choose a file: ' ) ;
term.fileInput(
//{ baseDir: __dirname + '/../' } ,
{ baseDir: '../' } ,
function( error , input ) {
if ( error )
{
term.red.bold( "\nAn error occurs: " + error + "\n" ) ;
}
else
{
term.green( "\nYour file is '%s'\n" , input ) ;
}
process.exit() ;
}
term.singleColumnMenu( items , function( error , response ) {
term( '\n' ).eraseLineAfter.green(
"#%s selected: %s (%s,%s)\n" ,
response.selectedIndex ,
response.selectedText ,
response.x ,
response.y
) ;
process.exit() ;
} ) ;
function areYouSure () {
term('DO YOU KNOW WHAT ARE YOU DOING? [y|N]\n')
term.yesOrNo({ yes: ['y'], no: ['n', 'ENTER'] }, (error, result) => {
if (error) process.exit(error)
if (result) {
main()
} else {
term.red("'No' detected, if you don't know what are you doing, ask on https://discordapp.com/invite/52KpmuH\n")
process.exit()
}
})
}
proxy.server.termEvents.on('log', txt => term(txt))
sass.render(sassConfig, function(err, result) {
//
if (!err) {
postcss([unprefixer, prefixer(post.autoprefixer), cssnano(post.cssnano)])
.process(result.css.toString())
.then(function(result) {
fs.writeFileSync(style.out, result.css);
});
} else {
term('[').red('BS')('] ')(err.message + '\n');
}
});
}
if(line.value) {
switch(line.type) {
case 'string':
term.yellow('"'+line.value+'"');
break;
case 'number':
term.cyan(line.value);
break;
case 'boolean':
term.magenta(line.value);
break;
case 'json':
term.colorRgb(150, 200, 255, line.value);
break;
default:
term(line.value);
break;
}
}
else if(line.empty) {
term.yellow('""');
}
else if(line.deleted) {
term.italic.colorRgb(50, 50, 50, '- removed -');
}
else {
term.colorRgb(50, 50, 50, '______');
}
term(',');
});
}
display.displayMessage = function( config , id , message ) {
if ( config.server ) { term.blue( 'Message from #%i:' , id ) ; }
else { term.blue( 'Message #%i:' , id ) ; }
term( ( message.indexOf( '\n' ) >= 0 ? '\n' : ' ' ) + message + '\n' ) ;
} ;