sync: sync wip stuff

This commit is contained in:
2026-05-12 10:38:30 +02:00
parent dc706d6262
commit 97b9994594
21 changed files with 532 additions and 100 deletions

View File

@@ -1,15 +1,23 @@
import { Item } from '../fs/Item'
import type { SimpleStream } from '../utils/SimpleStream'
import { Program } from './Program'
import { File } from '../fs/File'
import { Directory } from '../fs/Directory'
export class Ls extends Program {
constructor() {
super()
}
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, workdir: Directory, __: string[]): Promise<number> {
new Directory('/etc/system/idk')
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, workdir: Item, args: string[]): Promise<number> {
if (!(new Item(args[1]).IsDirectory())) {
stdout.emit("ls: error: the provided path is not a directory")
return 1
}
stdout.emit(`item: '${workdir.GetPath()}'\n`)
stdout.emit(`index attr name\n`)
workdir.List().forEach((entry, i) => {
stdout.emit(`${i.toString().padEnd(8, ' ')} ${''.padEnd(4, '-').padEnd(8, ' ')} '${entry.GetName()}'\n`)
})
return 0
}