From a930d8b647b46662620eadccee32024037b43524 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Mon, 3 Jun 2019 10:19:58 -0300 Subject: [PATCH] Replace empty logs and name escape sequence --- bin/lamassu-blacklist | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/bin/lamassu-blacklist b/bin/lamassu-blacklist index 7c657dfc..39a8743e 100644 --- a/bin/lamassu-blacklist +++ b/bin/lamassu-blacklist @@ -13,18 +13,14 @@ const rl = readline.createInterface({ const sql = `select regexp_replace(crypto_code, '$', ' ') as code,regexp_replace(address, '^', ' ') as address from blacklist` const insertSql = `insert into blacklist(crypto_code, address) values ($1, $2)` +const makeDimAndReset = '\x1b[2m%s\x1b[0m' db.query(sql) .then(many => { - console.log('') - console.log('Here is your current list of prohibited addresses:') - console.log('') - console.log(many.map(it => `${it.code} | ${it.address}`).join(os.EOL)) - console.log('') - console.log('What address would you like to add to the list?') - console.log('') - console.log('\x1b[2m%s\x1b[0m', 'Example:', 'bc1q8pu2zlfxg8jf4cyuf844rl3uxmmw8sj9yaa393') - console.log('') + console.log(os.EOL, 'Here is your current list of prohibited addresses:', os.EOL) + console.log(many.map(it => `${it.code} | ${it.address}`).join(os.EOL), os.EOL) + console.log('What address would you like to add to the list?', os.EOL) + console.log(makeDimAndReset, 'Example:', 'bc1q8pu2zlfxg8jf4cyuf844rl3uxmmw8sj9yaa393', os.EOL) rl.question('Address: ', (address) => { var aphaNumericRegex = /^([0-9]|[a-z])+([0-9a-z]+)$/i @@ -32,11 +28,8 @@ db.query(sql) return errorHandler(new Error('Invalid address')) } - console.log('') - console.log('What is the ticker symbol of the coin that this address belongs to?') - console.log('') - console.log('\x1b[2m%s\x1b[0m', 'Example:', 'BTC') - console.log('') + console.log(os.EOL, 'What is the ticker symbol of the coin that this address belongs to?', os.EOL) + console.log(makeDimAndReset, 'Example:', 'BTC', os.EOL) rl.question('Ticker symbol: ', (cryptoCode) => { try { @@ -45,13 +38,10 @@ db.query(sql) errorHandler(err) } - console.log('') - db.none(insertSql, [cryptoCode, address]) .then(() => db.query(sql)) .then(many2 => { - console.log(`Address added. Here's the new list of prohibited addresses:`) - console.log('') + console.log(os.EOL, `Address added. Here's the new list of prohibited addresses:`, os.EOL) console.log(many2.map(it => `${it.code} | ${it.address}`).join(os.EOL)) rl.close() process.exit(0)