diff options
Diffstat (limited to 'Master/texmf-dist/scripts/arara/rules/clean.yaml')
-rw-r--r-- | Master/texmf-dist/scripts/arara/rules/clean.yaml | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/Master/texmf-dist/scripts/arara/rules/clean.yaml b/Master/texmf-dist/scripts/arara/rules/clean.yaml index c9542f7979e..1a39ed3f27a 100644 --- a/Master/texmf-dist/scripts/arara/rules/clean.yaml +++ b/Master/texmf-dist/scripts/arara/rules/clean.yaml @@ -1,11 +1,51 @@ !config -# Clean rule for arara -# author: Paulo Cereda -# requires arara 3.0+ +# Arara, the cool TeX automation tool +# Copyright (c) 2018, Paulo Roberto Massa Cereda +# All rights reserved. +# +# This rule is part of arara. identifier: clean -name: CleaningTool -command: <arara> @{remove} +name: Clean +authors: +- Marco Daniel +- Paulo Cereda +commands: +- name: Cleaning feature + command: > + @{ + prefix = []; + if (isUnix()) { + prefix = [ 'rm', '-f' ]; + } + else { + prefix = [ 'cmd', '/c', 'del' ]; + } + if (extensions == '') { + if (getOriginalFile() == file) { + throwError('I cannot remove the main file reference.'); + } + return getCommand(prefix, file); + } + else { + base = getBasename(file); + removals = []; + foreach(extension : extensions) { + if (base.concat('.').concat(extension) == getOriginalFile()) { + throwError('I cannot remove the main file reference.'); + } + removals.add(getCommand(prefix, base.concat('.').concat(extension))); + } + return removals; + } + } arguments: -- identifier: remove - default: <arara> @{isFalse(file == getOriginalFile(), isWindows("cmd /c del", "rm -f").concat(' "').concat(file).concat('"'))} - +- identifier: extensions + flag: > + @{ + if (isList(parameters.extensions)) { + return parameters.extensions; + } + else { + throwError('I was expecting a list of extensions.'); + } + } |