ProzillaOS/src/features/apps/terminal/commands/rmdir.ts
2024-05-07 21:06:07 +02:00

18 lines
No EOL
466 B
TypeScript

import { formatError } from "../_utils/terminal.utils";
import Command from "../command";
export const rmdir = new Command()
.setRequireArgs(true)
.setManual({
purpose: "Remove a directory"
})
.setExecute(function(args, { currentDirectory }) {
const name = args[0];
const folder = currentDirectory.findSubFolder(name);
if (!folder)
return formatError(this.name, `${args[0]}: No such directory`);
folder.delete();
return { blank: true };
});