Skip to content

Commit

Permalink
Show usage if stdin is tty
Browse files Browse the repository at this point in the history
  • Loading branch information
lbovet committed Jan 16, 2016
1 parent da39c7a commit ab755d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "turtle-race",
"version": "1.0.0",
"version": "1.0.2",
"description": "Real-time metric graphs in the terminal",
"author": "Laurent Bovet <[email protected]>",
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions turtle-race.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ if(argv.c) {
}
pattern = new RegExp(config.pattern || "([^\\.]*)\\.?(.*)")
config.input = require('ttys').stdin
turtle = require('./index')(config);
if(process.argv.indexOf("-h") == -1) {
if(!process.stdin.isTTY) {
turtle = require('./index')(config);
process.stdin.pipe(require('split')()).on('data', function(line) {
if(line) {
turtle.start()
Expand All @@ -19,6 +19,6 @@ if(process.argv.indexOf("-h") == -1) {
}
});
} else {
process.stdout.write("Usage: turtle-race [-c config-file] [file]\n");
process.stdout.write("Usage: <command> | turtle-race [-c config-file] [file]\n");
process.exit(1);
}

0 comments on commit ab755d0

Please sign in to comment.