Skip to content

Commit

Permalink
Added .help and .ls vREPL command
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed Oct 18, 2023
1 parent 8573ec1 commit 5d93601
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/activator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default class Activator {
(result as PyOutCommandWithResponse).response +
"\x1b[0m" +
'Type "help()" for more information or ' +
".cls/.clear to clear the terminal." +
".help for custom vREPL commands." +
"\r\n".repeat(2)
);
}
Expand Down
17 changes: 17 additions & 0 deletions src/terminal.mts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,23 @@ export class Terminal implements Pseudoterminal {
this.writeEmitter.fire("\x1b[2J\x1b[0f");
this.prompt();

return;
} else if (input === ".ls") {
this.writeEmitter.fire("\r\n");
this.waitingForPrompt = true;
this.history.add(input);
this.submitEmitter.fire("import uos; uos.listdir()\n");

return;
} else if (input === ".help") {
this.writeEmitter.fire("\r\n");
this.writeEmitter.fire("Available vREPL commands:\r\n");
this.writeEmitter.fire(".cls/.clear - clear screen and prompt\r\n");
this.writeEmitter.fire(".empty - clean vREPL\r\n");
this.writeEmitter.fire(".ls - list files on Pico\r\n");
this.writeEmitter.fire(".help - show this help\r\n");
this.prompt();

return;
}

Expand Down

0 comments on commit 5d93601

Please sign in to comment.