- ls fixed - fixed a bug where ~ wouldnt resolve properly - temporarily increased the process chunking treshold, because chunking breaks formatting - added clear - added pwd
24 lines
735 B
TypeScript
24 lines
735 B
TypeScript
import type { CommandDescriptor, CommandOutput } from "@core/command";
|
|
import type { CommandIO } from "@core/command_io";
|
|
import { createSuccessResult, type ResultSuccess } from "@core/result";
|
|
import type { ShellState } from "@core/shell_state";
|
|
import type { ShellError } from "@core/util/errors";
|
|
|
|
export const COMMAND_NAME = "clear";
|
|
|
|
async function main(io: CommandIO, state: ShellState, __args: string[]): Promise<CommandOutput<ShellError>> {
|
|
io.writeStdout(new TextEncoder().encode("\x1b[2J\x1b[0;0H"));
|
|
|
|
const result: ResultSuccess = createSuccessResult(COMMAND_NAME);
|
|
|
|
return {
|
|
state: state,
|
|
result,
|
|
};
|
|
}
|
|
|
|
export const descriptor: CommandDescriptor = {
|
|
fn: main,
|
|
name: COMMAND_NAME,
|
|
};
|