The RVLq command-line tool
Description
RVLq is a command-line tool which replaces tags, mostly in a file, with text, content of a file or the output of a command.
Example
A source file, named Source.txt
, which contains tags, delimited by $
:
Text 1: $text1$
Text 2: $text2$
Text 3: $text3$
Text 4: $text4$
Text 1 again followed by text 5: $text1$, $text5$
File content: $file$
Command output: $command$
The tag file, named Tags.txt
, containing the definition of the tags in above file:
text1 &Simple text
text2 Text on 2 lines in the tags file, \
but displayed on one line thanks to the '\\' before the newline
# A comment.
text3 Text on one line in the tags file,\nbut displayed on 2 lines thanks to '\\n'
text4 Text with a tabulation here:>\t< thanks to '\\t'
text5 and another simple texte
file %File.txt
command @echo Text issued by the echo command
Another file, named File.txt
, which is referenced in above file:
This is the content of a file!
Launching rvlq Tags.txt Source.txt
outputs following:
Text 1: Simple text
Text 2: Text on 2 lines in the tags file, but displayed on one line thanks to the '\' before the newline
Text 3: Text on one line in the tags file,
but displayed on 2 lines thanks to '\n'
Text 4: Text with a tabulation here:> < thanks to '\t'
Text 1 again followed by text 5: Simple text, and another simple texte
File content: This is the content of a file!
Command output: Text issued by the echo command
The tags definition file
This file must contain the definition of all the tags which are in the source file. Each line begins with the tag label, without the delimiters, followed by one or more tabulation, and the definition of the tag, There are three type of definition:
- a text, beginning with the
&
character immediately followed by the text (the&
character can be omitted), - a file content, beginning with the
%
character immediately followed by the filename, - the output of a command, beginning with the
@
character, immediately followed by the command.
A text definition can be splitted over several line, by preceding the newline with a backslash (\
). You can also insert a newline with \n
, a tabulation with \b
and a backslash with \\
.
All characters on the same line following the #
character are ignored.
A tags definition file can contain blank lines, which are ignored.
Command-line arguments
Launch rvlq --help
to have details concerning the command-line arguments.
Resources
- GitHub repository: http://github.com/epeios-q37/rvlq-cli