chore: rewrite loadprg & fix some issues
This commit is contained in:
@@ -29,6 +29,8 @@ import { Environment } from './Environment'
|
||||
import { InputManager } from './InputManager'
|
||||
import { Edit } from '../../program/Edit'
|
||||
import { Mv } from '../../program/Mv'
|
||||
import { Tree } from '../../program/Tree'
|
||||
import { Cp } from '../../program/Cp'
|
||||
|
||||
export class Wush extends Shell {
|
||||
public readonly Version = "0.3.2"
|
||||
@@ -96,6 +98,8 @@ export class Wush extends Shell {
|
||||
this.programs['printf'] = new Printf()
|
||||
this.programs['edit'] = new Edit()
|
||||
this.programs['mv'] = new Mv()
|
||||
this.programs['cp'] = new Cp()
|
||||
this.programs['tree'] = new Tree()
|
||||
|
||||
// reset exit code
|
||||
this.SetExitCode(0)
|
||||
@@ -685,7 +689,7 @@ export class Wush extends Shell {
|
||||
if (item.IsDirectory())
|
||||
throw new Error(`input file ${resolved} is a directory`)
|
||||
|
||||
return { stream: new SimpleStream<string>(), data: item.ReadData() ?? '' }
|
||||
return { stream: new SimpleStream<string>(), data: item.GetData() ?? '' }
|
||||
}
|
||||
|
||||
const openOutputRedirect = async (path: string, append: boolean) => {
|
||||
@@ -894,11 +898,14 @@ export class Wush extends Shell {
|
||||
this.terminal.NewPage()
|
||||
return true
|
||||
}
|
||||
case 'm': {
|
||||
this.terminal.ApplyCellStyleCodes(values)
|
||||
return true
|
||||
}
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private GetWrapWidth(): number {
|
||||
const width = Math.floor(this.terminal.GetWidthCells())
|
||||
if (!Number.isFinite(width) || width <= 0)
|
||||
|
||||
Reference in New Issue
Block a user