Bash and IO working, basic error setup. Changelog:

Commands:
    - ls (only with -l)
    - cd (basic, probably unfinished)
This commit is contained in:
2025-11-20 14:10:20 +01:00
committed by Kamil Olszewski
parent 4428cc7e8a
commit e853268e52
15 changed files with 775 additions and 441 deletions

View File

@@ -0,0 +1,41 @@
import { mount, unmount } from 'svelte';
import Output from '../../../modules/terminal/Output.svelte';
import { isInitializing } from './init.svelte';
import type { PrintData } from './terminal';
interface OutputProps {
path: string;
output: any;
cmd: string;
}
const outputInstances = new Set<Output>();
function appendOutput(container: HTMLElement, props: OutputProps): Output | undefined {
if (!container) return;
const instance = mount(Output, {
target: container,
props
});
outputInstances.add(instance);
return instance;
}
export function print(e: HTMLElement, data: PrintData): void {
if (isInitializing()) {
console.error('Terminal is initializing! Skipping Print');
return;
}
appendOutput(e, {
path: data.path,
output: data.output,
cmd: data.cmd
});
}
export function clear(): void {
for (const n of outputInstances) {
unmount(n);
}
}