Skip to content

Commit

Permalink
feat(tsfmt): change --stdio option to do not required fileName
Browse files Browse the repository at this point in the history
  • Loading branch information
vvakame committed May 8, 2015
1 parent 6d3ff3b commit 3205551
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var root = commandpost
var editorconfig = !!opts.editorconfig;
var tsfmt = !!opts.tsfmt;

if (args.files.length === 0) {
if (args.files.length === 0 && !opts.stdin) {
process.stdout.write(root.helpText() + '\n');
return;
}
Expand All @@ -54,8 +54,12 @@ var root = commandpost
}

if (opts.stdin) {
if (opts.replace) {
errorHandler("--stdin option can not use with --replace option");
return;
}
lib
.processStream(args.files[0], process.stdin, {
.processStream(args.files[0] || "temp.ts", process.stdin, {
replace: replace,
tslint: tslint,
editorconfig: editorconfig,
Expand Down Expand Up @@ -89,4 +93,4 @@ function errorHandler(err:any) {
return Promise.resolve(null).then(()=> {
process.exit(1);
});
}
}

0 comments on commit 3205551

Please sign in to comment.