Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
kodi committed Aug 25, 2019
1 parent e15f040 commit 6e25981
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#!/usr/bin/env node
const chalk = require('chalk');
const meow = require('meow');


const Tail = require('tail').Tail;

// CLI Stuff
const cli = meow(`
------------------
S P L E X
_____ _
/ ____| | |
| (___ _ __ | | _____ __
\\___ \\| '_ \\| |/ _ \\ \\/ /
____) | |_) | | __/> <
|_____/| .__/|_|\\___/_/\\_\\
| |
|_|
------------------
Usage:
$ splex [options] file1 file 2 fileX
Expand Down Expand Up @@ -50,7 +44,6 @@ let colors = [
]



// create index of fileName -> color
let colorIdx = {};
filenames.forEach((f, idx) => {
Expand All @@ -68,24 +61,17 @@ filenames.forEach((f) => {
listeners[f].on('line', (l) => {
let color = colorIdx[f];
if(cli.flags.t) {

const logString = `> ${f}: | ${l} `;
console.log(chalk[color](`> ${f}: `) + chalk.green('| ') + chalk.white(`${l}`));
console.log(chalk.green('-'.repeat(termSize)));
} else {

console.log(chalk[color](`> ${f}: `) + chalk.white(`${l}`));
}
});



listeners[f].on('eof', pos => console.log("Catched up to the last line") );
listeners[f].on('error', err => console.log('Error: ', err));
listeners[f].on('ready', fd => console.log('Ready to start on: ', fd));
console.log(chalk[colorIdx[f]]('Setting up listener for: ') + f);
});

// wait in loop, until someone presses ctrl-c
x = setInterval(() => {
}, 1500);
}, 1000);

0 comments on commit 6e25981

Please sign in to comment.