working on the file system
cd can now display folders in blue
This commit is contained in:
@ -1,13 +1,15 @@
|
||||
import { set_working_dir, SetDirStatus } from "../../fs/fn"
|
||||
import type { Args, Term } from "../list"
|
||||
|
||||
import stdout from "../../../elements/stdout"
|
||||
|
||||
export default function cd(term: Term, args: Args): boolean {
|
||||
const new_dir_status = set_working_dir(args[1])
|
||||
|
||||
if (new_dir_status === SetDirStatus.NotADirectory) {
|
||||
// return <p>{"cd: \""}{bold(args[1])}{"\" is not a directory"}</p>
|
||||
term.appendChild(stdout(`cd: "${args[1]}" is not a directory`))
|
||||
} else if (new_dir_status === SetDirStatus.NotFound) {
|
||||
// return <p>{"cd: The directory \""}{bold(args[1])}{"\" does not exist"}</p>
|
||||
term.appendChild(stdout(`cd: The directory "${args[1]}" does not exist`))
|
||||
}
|
||||
return true
|
||||
}
|
Reference in New Issue
Block a user