20 lines
515 B
TypeScript

import { IShellCommand } from "./IShellCommand";
import { ShellSyscall } from "../ShellSyscall";
export class cat implements IShellCommand {
constructor(private syscall: ShellSyscall) {}
getName(): string {
return "cat";
}
execute(args: string[]): string {
if (args.length === 0) return "cat: missing file operand";
return this.syscall.readFile(args[0]);
}
getManPage(): string {
return "cat - concatenate files and print on the standard output";
}
}