We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 525864a commit 248d396Copy full SHA for 248d396
βapp/main.js
@@ -2,15 +2,25 @@ const readline = require("readline");
2
3
const commands = [];
4
5
+let terminal = true;
6
+
7
const rl = readline.createInterface({
8
input: process.stdin,
9
output: process.stdout,
10
});
11
-rl.question("$ ", (answer) => {
- const command = answer.split(" ")[0];
12
- if (!commands.includes(command)) {
13
- console.log(`${command}: command not found`);
14
- }
15
- rl.close();
16
-});
+const promptUser = () => {
+ rl.question("$ ", (answer) => {
+ const command = answer.split(" ")[0];
+ if (!commands.includes(command)) {
+ console.log(`${command}: command not found`);
17
+ }
18
+ if (terminal) {
19
+ promptUser();
20
+ } else {
21
+ rl.close();
22
23
+ });
24
+};
25
26
+promptUser();
0 commit comments