terminal prompt needs to be recyclable

This commit is contained in:
2025-02-03 03:01:06 -05:00
parent 390ff9bccf
commit 49a62df236
14 changed files with 179 additions and 116 deletions

View File

@ -1,17 +1,32 @@
let working_dir = "user"
const enum EntryType {
Directory,
File
}
type File = string
type Entry<T> = {
readonly inner: T,
readonly type: EntryType
}
function Entry<T = File>(inner: T): Entry<T> {
const type = typeof inner == "object" ? EntryType.Directory : EntryType.File
return { inner: inner, type: type }
}
const user = {
["about_me"]: {},
["services"]: {}
["about_me.txt"]: Entry(""),
["services.txt"]: Entry("")
}
const home = {
["user"]: user
["user"]: Entry(user)
}
const root = {
["bin"]: {},
["home"]: {}
["bin"]: Entry({}),
["home"]: Entry(home)
}
const fs = {
["/"]: root
["/"]: Entry(root)
}
export { fs }
export { fs, working_dir }