arara: How to widen out clean.yaml
up vote
4
down vote
favorite
I read the clean-rule for version 4. % arara: clean: { extensions: [aux, bcl ] }
deletes jobname.aux
and jobname.bcl
.
I would like to have a rule "cleanx.yaml
" (or a shifter for clean.yaml
), which deletes all files (*.aux and *.bcl) with the named extensions.
How can I do that? I tried concat('*')
for 'base', but this does not work.
!config
# 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: 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: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
arara
add a comment |
up vote
4
down vote
favorite
I read the clean-rule for version 4. % arara: clean: { extensions: [aux, bcl ] }
deletes jobname.aux
and jobname.bcl
.
I would like to have a rule "cleanx.yaml
" (or a shifter for clean.yaml
), which deletes all files (*.aux and *.bcl) with the named extensions.
How can I do that? I tried concat('*')
for 'base', but this does not work.
!config
# 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: 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: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
arara
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I read the clean-rule for version 4. % arara: clean: { extensions: [aux, bcl ] }
deletes jobname.aux
and jobname.bcl
.
I would like to have a rule "cleanx.yaml
" (or a shifter for clean.yaml
), which deletes all files (*.aux and *.bcl) with the named extensions.
How can I do that? I tried concat('*')
for 'base', but this does not work.
!config
# 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: 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: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
arara
I read the clean-rule for version 4. % arara: clean: { extensions: [aux, bcl ] }
deletes jobname.aux
and jobname.bcl
.
I would like to have a rule "cleanx.yaml
" (or a shifter for clean.yaml
), which deletes all files (*.aux and *.bcl) with the named extensions.
How can I do that? I tried concat('*')
for 'base', but this does not work.
!config
# 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: 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: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
arara
arara
edited 11 mins ago
asked 2 hours ago
cis
570414
570414
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
This new rule might do exactly what you want. However, be mindful to use it with great care!
File cleanx.yaml
:
!config
identifier: cleanx
name: CleanX
authors:
- 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 {
directory = getOriginalReference().getAbsoluteFile().getParent();
matches = listFilesByExtensions(directory, extensions, recursive);
removals = ;
foreach(match : matches) {
if (match.equals(getOriginalReference())) {
throwError('I cannot remove the main file reference.');
}
removals.add(getCommand(prefix, match));
}
return removals;
}
}
arguments:
- identifier: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
- identifier: recursive
flag: >
@{
return isTrue(parameters.recursive);
}
default: false
Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive
and provide a natural boolean value such as true
or yes
.
A quick experiment. My file header:
% arara: cleanx: { extensions: [ aux ] }
Terminal usage:
$ touch foo.aux bar.aux
$ arara -n test.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
__,_|_| __,_|_| __,_|
Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
12:41:56), please wait.
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/foo.aux ]
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/bar.aux ]
Total: 0.19 seconds
Works fine.... ;)
– cis
1 hour ago
@cis Yaaay!:)
– Paulo Cereda
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
This new rule might do exactly what you want. However, be mindful to use it with great care!
File cleanx.yaml
:
!config
identifier: cleanx
name: CleanX
authors:
- 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 {
directory = getOriginalReference().getAbsoluteFile().getParent();
matches = listFilesByExtensions(directory, extensions, recursive);
removals = ;
foreach(match : matches) {
if (match.equals(getOriginalReference())) {
throwError('I cannot remove the main file reference.');
}
removals.add(getCommand(prefix, match));
}
return removals;
}
}
arguments:
- identifier: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
- identifier: recursive
flag: >
@{
return isTrue(parameters.recursive);
}
default: false
Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive
and provide a natural boolean value such as true
or yes
.
A quick experiment. My file header:
% arara: cleanx: { extensions: [ aux ] }
Terminal usage:
$ touch foo.aux bar.aux
$ arara -n test.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
__,_|_| __,_|_| __,_|
Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
12:41:56), please wait.
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/foo.aux ]
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/bar.aux ]
Total: 0.19 seconds
Works fine.... ;)
– cis
1 hour ago
@cis Yaaay!:)
– Paulo Cereda
1 hour ago
add a comment |
up vote
4
down vote
accepted
This new rule might do exactly what you want. However, be mindful to use it with great care!
File cleanx.yaml
:
!config
identifier: cleanx
name: CleanX
authors:
- 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 {
directory = getOriginalReference().getAbsoluteFile().getParent();
matches = listFilesByExtensions(directory, extensions, recursive);
removals = ;
foreach(match : matches) {
if (match.equals(getOriginalReference())) {
throwError('I cannot remove the main file reference.');
}
removals.add(getCommand(prefix, match));
}
return removals;
}
}
arguments:
- identifier: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
- identifier: recursive
flag: >
@{
return isTrue(parameters.recursive);
}
default: false
Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive
and provide a natural boolean value such as true
or yes
.
A quick experiment. My file header:
% arara: cleanx: { extensions: [ aux ] }
Terminal usage:
$ touch foo.aux bar.aux
$ arara -n test.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
__,_|_| __,_|_| __,_|
Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
12:41:56), please wait.
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/foo.aux ]
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/bar.aux ]
Total: 0.19 seconds
Works fine.... ;)
– cis
1 hour ago
@cis Yaaay!:)
– Paulo Cereda
1 hour ago
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
This new rule might do exactly what you want. However, be mindful to use it with great care!
File cleanx.yaml
:
!config
identifier: cleanx
name: CleanX
authors:
- 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 {
directory = getOriginalReference().getAbsoluteFile().getParent();
matches = listFilesByExtensions(directory, extensions, recursive);
removals = ;
foreach(match : matches) {
if (match.equals(getOriginalReference())) {
throwError('I cannot remove the main file reference.');
}
removals.add(getCommand(prefix, match));
}
return removals;
}
}
arguments:
- identifier: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
- identifier: recursive
flag: >
@{
return isTrue(parameters.recursive);
}
default: false
Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive
and provide a natural boolean value such as true
or yes
.
A quick experiment. My file header:
% arara: cleanx: { extensions: [ aux ] }
Terminal usage:
$ touch foo.aux bar.aux
$ arara -n test.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
__,_|_| __,_|_| __,_|
Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
12:41:56), please wait.
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/foo.aux ]
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/bar.aux ]
Total: 0.19 seconds
This new rule might do exactly what you want. However, be mindful to use it with great care!
File cleanx.yaml
:
!config
identifier: cleanx
name: CleanX
authors:
- 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 {
directory = getOriginalReference().getAbsoluteFile().getParent();
matches = listFilesByExtensions(directory, extensions, recursive);
removals = ;
foreach(match : matches) {
if (match.equals(getOriginalReference())) {
throwError('I cannot remove the main file reference.');
}
removals.add(getCommand(prefix, match));
}
return removals;
}
}
arguments:
- identifier: extensions
flag: >
@{
if (isList(parameters.extensions)) {
return parameters.extensions;
}
else {
throwError('I was expecting a list of extensions.');
}
}
- identifier: recursive
flag: >
@{
return isTrue(parameters.recursive);
}
default: false
Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive
and provide a natural boolean value such as true
or yes
.
A quick experiment. My file header:
% arara: cleanx: { extensions: [ aux ] }
Terminal usage:
$ touch foo.aux bar.aux
$ arara -n test.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
__,_|_| __,_|_| __,_|
Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
12:41:56), please wait.
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/foo.aux ]
[DR] (CleanX) Cleaning feature
-----------------------------------------------------------------
Author: Paulo Cereda
About to run: [ rm, -f, /home/paulo/bar.aux ]
Total: 0.19 seconds
answered 1 hour ago
Paulo Cereda
32.7k8122205
32.7k8122205
Works fine.... ;)
– cis
1 hour ago
@cis Yaaay!:)
– Paulo Cereda
1 hour ago
add a comment |
Works fine.... ;)
– cis
1 hour ago
@cis Yaaay!:)
– Paulo Cereda
1 hour ago
Works fine.... ;)
– cis
1 hour ago
Works fine.... ;)
– cis
1 hour ago
@cis Yaaay!
:)
– Paulo Cereda
1 hour ago
@cis Yaaay!
:)
– Paulo Cereda
1 hour ago
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459627%2farara-how-to-widen-out-clean-yaml%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password