sync: wip advanced command parser
This commit is contained in:
@@ -11,18 +11,11 @@ export class Loadprg extends Program {
|
||||
this.shell = shell
|
||||
}
|
||||
|
||||
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, __: Item, args: string[]): Promise<number> {
|
||||
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, workdir: Item, args: string[]): Promise<number> {
|
||||
const javascript = args.slice(2).join(' ')
|
||||
|
||||
try {
|
||||
const exec: Function = eval(javascript)
|
||||
|
||||
const program = class extends Program {
|
||||
async Exec(stdin: SimpleStream<string>, stdout: SimpleStream<string>, workdir: Item, args: string[]): Promise<number> {
|
||||
exec(stdin, stdout, workdir, args)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
const program = eval(javascript)
|
||||
|
||||
this.shell.LoadProgram(new program(), args[1])
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Item } from '../fs/Item'
|
||||
import type { Wush } from '../shell/Wush'
|
||||
import type { Wush } from '../shell/wush/Wush'
|
||||
import type { SimpleStream } from '../utils/SimpleStream'
|
||||
import { Program } from './Program'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user