@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
32 lines • 1.44 kB
TypeScript
import { type FileStat, type PathSpec } from '../../../types.ts';
import type { CommandFnResult } from '../../config.ts';
import type { MountView } from '../../../view/types.ts';
export declare function rmWithoutOperands(force: boolean): CommandFnResult;
/**
* Remove a directory tree entry by entry, as GNU `rm -r` does.
*
* For a tree whose one-call removal the dispatcher declined, so each removal
* is judged on its own. An entry that cannot be removed, or a directory that
* cannot be opened, is a failure, and the directories above it stay without a
* line of their own, since they are not empty (coreutils 9.7). The links a
* directory holds go with it; a hidden one is left to the directory's own
* removal, which takes what the session cannot see. A mount below is never
* entered, as GNU's `--one-file-system` does, and the directories holding one
* stay. Under `-f` an entry gone before its removal is no failure. Mirrors
* Python's `remove_tree`.
*/
export declare function removeTree(root: PathSpec, ops: {
readdir: (path: PathSpec) => Promise<string[]>;
stat: (path: PathSpec) => Promise<FileStat>;
unlink: (path: PathSpec) => Promise<void>;
rmdir: (path: PathSpec) => Promise<void>;
mounts: MountView | undefined;
force: boolean;
}): Promise<{
removed: {
path: string;
isDir: boolean;
}[];
failures: [PathSpec, unknown][];
}>;
//# sourceMappingURL=rm_cmd.d.ts.map