Skip to content

Commit 3f42713

Browse files
Vyacheslav Moskalenkotonyganch
authored andcommitted
Add new --tty-mode option for cli
1 parent cece432 commit 3f42713

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

doc/usage-cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ csscomb -h
3737
-c, --config [path] configuration file path
3838
-d, --detect detect mode (would return detected options)
3939
-l, --lint in case some fixes needed returns an error
40+
-t, --tty-mode execution in TTY mode (useful, when running tool using external app, e.g. IDE)
4041
```
4142
4243
### config

src/cli.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if (options.detect) {
4343
var config = getConfig();
4444
comb.configure(config);
4545

46-
if (process.stdin.isTTY) {
46+
if (options.ttymode || process.stdin.isTTY) {
4747
processFiles(options._);
4848
} else {
4949
processSTDIN();
@@ -58,7 +58,8 @@ function getOptions() {
5858
detect: 'd',
5959
lint: 'l',
6060
help: 'h',
61-
verbose: 'v'
61+
verbose: 'v',
62+
'tty-mode': 't'
6263
}
6364
};
6465
return parseArgs(process.argv.slice(2), parserOptions);
@@ -83,7 +84,9 @@ function displayHelp() {
8384
' -h, --help',
8485
' Display help message.',
8586
' -v, --verbose',
86-
' Whether to print logging info.'
87+
' Whether to print logging info.',
88+
' -t, --tty-mode',
89+
' Run the tool in TTY mode using external app (e.g. IDE).'
8790
];
8891
process.stdout.write(help.join('\n'));
8992
}

0 commit comments

Comments
 (0)