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.
53 lines
1.1 KiB
53 lines
1.1 KiB
8 months ago
|
!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.getCanonicalPath()));
|
||
|
}
|
||
|
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
|