-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lisandro Martinez
committed
Oct 10, 2019
1 parent
9f70fe9
commit 93138af
Showing
5 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
48 content | ||
1 content | ||
2 content | ||
3 content |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |