Skip to content

Commit 3205551

Browse files
committed
feat(tsfmt): change --stdio option to do not required fileName
1 parent 6d3ff3b commit 3205551

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/cli.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var root = commandpost
4040
var editorconfig = !!opts.editorconfig;
4141
var tsfmt = !!opts.tsfmt;
4242

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

5656
if (opts.stdin) {
57+
if (opts.replace) {
58+
errorHandler("--stdin option can not use with --replace option");
59+
return;
60+
}
5761
lib
58-
.processStream(args.files[0], process.stdin, {
62+
.processStream(args.files[0] || "temp.ts", process.stdin, {
5963
replace: replace,
6064
tslint: tslint,
6165
editorconfig: editorconfig,
@@ -89,4 +93,4 @@ function errorHandler(err:any) {
8993
return Promise.resolve(null).then(()=> {
9094
process.exit(1);
9195
});
92-
}
96+
}

0 commit comments

Comments
 (0)