UNPKG

@plugjs/plug

Version:
24 lines 712 B
import { rm } from "../fs.js"; import { $gry, $p } from "../logging.js"; import { install } from "../pipe.js"; /** Remove some files using globs. */ install('rmf', class Rmf { _dryRun; constructor(dryRun) { this._dryRun = !!dryRun; } async pipe(files, context) { if (this._dryRun) { for (const file of files.absolutePaths()) { context.log.notice('Not removing file', $p(file), $gry('(dry-run)')); } } else { for (const file of files.absolutePaths()) { context.log.notice('Removing file', $p(file)); await rm(file); } } } }); //# sourceMappingURL=rmf.js.map