terminal prompt needs to be recyclable
This commit is contained in:
@ -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 }
|
Reference in New Issue
Block a user