taraskevizer 5.1.2 → 5.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.js +15 -5
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -101,12 +101,22 @@ while (currOption = process.argv.shift()) {
101
101
  break;
102
102
  }
103
103
  }
104
- let text = process.argv.length ? process.argv.join(" ") : await readline.createInterface({
105
- input: process.stdin,
106
- output: process.stdout
107
- }).question(prefix + "Enter the text:\n");
104
+ let text = "";
105
+ if (process.argv.length) {
106
+ text = process.argv.join(" ");
107
+ } else {
108
+ if (process.stdin.isTTY) {
109
+ text = await readline.createInterface({
110
+ input: process.stdin,
111
+ output: process.stdout
112
+ }).question(prefix + "Enter the text:\n");
113
+ } else {
114
+ for await (const chunk of process.stdin)
115
+ text += chunk;
116
+ }
117
+ }
108
118
  const taraskevizer = new Taraskevizer({ general, html, nonHtml });
109
119
  process.stdout.write(
110
- isHtml ? taraskevizer.convertToHtml(text) : taraskevizer.convert(text)
120
+ (isHtml ? taraskevizer.convertToHtml(text) : taraskevizer.convert(text)) + "\n"
111
121
  );
112
122
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "5.1.2",
3
+ "version": "5.1.3",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",