Yes, this can certainly be done. Thanks to Paulo (arara
creator) for his help on this one :)
Let's say that your .bashrc
contains the following
function hello() {
echo "Hello, $0!"
}
export -f hello
Note the use of export
to make the hello
function available from the command line.
We can then make our arara
rule to contain the line
- <arara> bash -i -c hello @{name}
Note the use of the i
and c
flags. The rule can then be used either as
% arara: hello
or
% arara: hello: {name: Ellett}
hello.yaml
!config
# Hello world
# author: Chris Hughes, Paulo Cereda
# last edited by: cmh, June 14th 2013
# requires arara 3.0+
#
# Sample usage:
#
# % arara: hello
# % arara: hello: {name: A.Ellett}
#
# This rule is really just a shortcut for commands like the following
#
# hello
# or
# hello A.Ellett
#
identifier: hello
name: hello
commands:
- <arara> bash -i -c hello @{name}
arguments:
- identifier: name
flag: <arara> @{parameters.name}
default: "world"
myfile.tex
% arara: hello
% arara: hello: {name: Ellett}
\documentclass{article}
\begin{document}
test
\end{document}
And here's the output from arara -v myfile.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
\__,_|_| \__,_|_| \__,_|
Running hello...
Hello, world!
Status: SUCCESS
Running hello...
Hello, Ellett!
Status: SUCCESS