You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.0 KiB

!config
identifier: remove
name: Remove
commands:
- name: The removal feature
command: >
@{
dir = directory[0];
rec = Boolean.valueOf(recursive[0]);
entries = listFilesByPatterns(
toFile(dir),
patterns,
rec);
prefix = [];
if (isUnix()) {
prefix = [ 'rm', '-f' ];
}
else {
prefix = [ 'cmd', '/c', 'del' ];
}
removals = [];
for (entry : entries) {
removals.add(getCommand(prefix, entry))
}
return removals;
}
arguments:
- identifier: directory
flag: >
@{
return parameters.directory
}
default: '.'
- identifier: recursive
flag: >
@{
return isTrue(parameters.recursive)
}
default: >
@{
return false
}
- identifier: patterns
flag: >
@{
if (!isList(parameters.patterns)) {
throwError('I was expecting a list!');
}
return parameters.patterns;
}
required: true