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.
- package/dist/bin.js +15 -5
- 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 =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
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);
|