feat: add some utilities
This commit is contained in:
19
src/program/Lsprg.ts
Normal file
19
src/program/Lsprg.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { Wush } from '../shell/Wush'
|
||||
import type { SimpleStream } from '../utils/SimpleStream'
|
||||
import { Program } from './Program'
|
||||
|
||||
export class Lsprg extends Program {
|
||||
private wush: Wush
|
||||
|
||||
constructor(wush: Wush) {
|
||||
super()
|
||||
this.wush = wush
|
||||
}
|
||||
|
||||
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, __: string[]): Promise<number> {
|
||||
for (const program in this.wush.GetPrograms())
|
||||
stdout.emit(`${program}\n`)
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user