This repository has been archived on 2025-08-18. You can view files and clone it, but cannot push or open issues or pull requests.
Files
new-home/src/shell/commands/rm.ts

29 lines
640 B
TypeScript

import { IShellCommand } from "./IShellCommand";
import { ShellSyscall } from "../ShellSyscall";
export class rm implements IShellCommand {
private syscall: ShellSyscall;
constructor(syscall: ShellSyscall) {
this.syscall = syscall;
}
getName(): string {
return "rm";
}
execute(args: string[]): string {
if (args.length < 1) {
return "Usage: rm <filename>";
}
const filename = args[0];
this.syscall.deleteFile(filename);
return `Removed ${filename}`;
}
getManPage(): string {
return "rm - remove files or directories";
}
}