Skip to content

Commit cf0e9b7

Browse files
committed
builtin completion
1 parent e80f469 commit cf0e9b7

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

app/ExternalCommand.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ class ExternalCommand extends Command {
1010
}
1111

1212
async execute(args) {
13-
try {
14-
await this.executeCommand(this.commandPath, args);
15-
conso
16-
} catch (error) {
17-
}
13+
await this.executeCommand(this.commandPath, args);
1814
return { shouldContinue: true };
1915
}
2016

app/InputHandler.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ class InputHandler {
44
this.inputBuffer = '';
55
}
66

7-
async getInput(prompt) {
7+
async getInput() {
88
return new Promise((resolve) => {
9-
this.readline.setPrompt(prompt);
10-
this.readline.prompt();
11-
129
const onKeypress = (char, key) => {
1310
if (key.name === 'return' || key.name === 'enter') {
1411
this.readline.input.removeListener('keypress', onKeypress);

app/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ class Shell {
201201
let shouldContinue = true;
202202

203203
while (shouldContinue) {
204-
const input = await this.inputHandler.getInput("$ ");
204+
this.inputHandler.readline.setPrompt("$ ");
205+
this.readline.prompt();
206+
const input = await this.inputHandler.getInput();
205207

206208
if (input.trim() === '') {
207209
console.log("Empty command, please try again.");

0 commit comments

Comments
 (0)