Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lisandro Martinez committed Oct 10, 2019
1 parent 9f70fe9 commit 93138af
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
67 changes: 67 additions & 0 deletions genTestLog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
var fs = require('fs');
var yargs = require('yargs');
var INTERVAL = (Number(yargs.argv.i || yargs.argv.interval || process.argv[2]) || 1) * 1000 || 1000;
var TIMER_DELAY = Number(yargs.argv.t || yargs.argv.timerDelay ||process.argv[3]) || 0;
var i = 0;

var newLine = false;
//console.log('INTERVAL',INTERVAL,'TIMER_DELAY',TIMER_DELAY)
setInterval(() => {
newLine = true;
i++;
fs.appendFile('log.txt', `${i} content\n`, function(err) {
if (err) throw err;
//console.log(`${i} -- Saved!`);
});
}, INTERVAL);

var cur_interval = 0;

setInterval(() => {
cur_interval++;
process.stdout.write(`-${cur_interval}-`);
if (newLine) {
console.log(i);
cur_interval = 0;
}
newLine = false;
}, TIMER_DELAY);





//generates a test log file
yargs.command(['[interval]', '[i]'], 'Integer describing how often to run the update in seconds.', (yargs) => {
yargs
.positional('interval', {
describe: 'Integer describing how often to run the update',
default: 1
});

}, (argv) => {
if (argv.verbose) console.info(`start server on :${argv.port}`)
serve(argv.port)
})
.command(['[timerDelay]', '[t]'], 'Integer describing how often show the progress in seconds', (yargs) => {
yargs
.positional('timerDelay', {
describe: 'Integer describing how often show the progress in seconds',
default: 1
})

}, (argv) => {
if (argv.verbose) console.info(`start server on :${argv.port}`)
serve(argv.port)
})
.option('timerDelay', {
alias: 't',
type: 'number',
description: 'Integer describing how often show the progress in seconds'
})
.option('interval', {
alias: 'i',
type: 'number',
description: 'Integer describing how often to run the update in seconds'
})
.argv
4 changes: 4 additions & 0 deletions log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
48 content
1 content
2 content
3 content
192 changes: 192 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "diff-test",
"version": "1.0.0",
"description": "",
"main": "genTestLog.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"yargs": "^14.2.0"
}
}

0 comments on commit 93138af

Please sign in to comment.