Skip to content

Commit

Permalink
Fix help command in Terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsLap committed Dec 21, 2023
1 parent 9af8246 commit 20cd76c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions pkgs/apps/Terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export default {
},
};

let Terminal = new Html("div").class("no-ui").html(/*html*/ `<div><div class="output">Welcome to Pluto's terminal!<br>Enter 'js' in the terminal if you want to switch to JavaScript.<br></div></div><div class="userInput"><div style="display:flex;" id="inputDiv"><span class="prompt">${Term.prompt}</span><div class="none input" contenteditable="true"></div></div></div>`);
let Terminal = new Html("div")
.class("no-ui")
.html(
/*html*/ `<div><div class="output">Welcome to Pluto's terminal!<br>Enter 'js' in the terminal if you want to switch to JavaScript.<br></div></div><div class="userInput"><div style="display:flex;" id="inputDiv"><span class="prompt">${Term.prompt}</span><div class="none input" contenteditable="true"></div></div></div>`
);

Terminal.appendTo(wrapper);

Expand Down Expand Up @@ -178,20 +182,25 @@ export default {
let path = "Root";

function setPromptPath() {
Term.setPrompt(`<Span style="color:var(--primary)">${path === "Root" ? "~" : path}</Span>%&nbsp;`);
Term.setPrompt(
`<Span style="color:var(--primary)">${
path === "Root" ? "~" : path
}</Span>%&nbsp;`
);
}

setPromptPath();

setPromptPath();

async function runCommand(elm, input = "") {
// debugger;
document
.querySelector(".no-ui .output")
.insertAdjacentHTML(
"beforeend",
elm
.closest(".userInput")
.innerText.replace(/ /g, '').replace("\n", "")
.innerText.replace(/ /g, "")
.replace("\n", "")
.replace(/\n/g, "<br>") + "<br>"
);

Expand Down Expand Up @@ -250,7 +259,7 @@ export default {
pwd Print the current directory
rm [file] Delete a file
rmdir [dir] Delete a directory
touch [file] Create a file\n`
touch [file] Create a file<br>`
);
break;
case "clear":
Expand Down

0 comments on commit 20cd76c

Please sign in to comment.