Tools
There are two tools available for processing files and directories:
- org.hoglet.tools.FileProcessor - will process an input file and write it out to the output file.
- org.hoglet.tools.DirectoryProcessor - will process all the files (limited to a file extension) in a start directory and write those files out to the output directory, it will change the file extension to that nominated.
FileProcessor
Process an input file containing hoglet markup and write to the output file.
Supports the following arguments:
Usage
> java org.hoglet.tools.FileProcessor [xml config file] [input file] [output file] [overwrite]
Supports the following arguments:
Argument | Optional | Description |
xml config file | No | Is the full path to the config file for the tag, handlers and delimiters that the parser should use for processing. |
input file | No | The input file that contains the hoglet markup. |
output file | No | The output file. |
overwrite | Yes | Should be either: true or false. If true then the processor will overwrite the output file if it already exists. If false and the output file already exists then the output file is not overwritten and an error is returned. |
Example
This assumes that you are running hoglet from the install directory using the default tag handlers config file.> java org.hoglet.tools.FileProcessor data/tag-handlers.xml /home/me/myfile.txt /home/me/myfile.html true
DirectoryProcessor
Process files in an input directory containing hoglet markup and write to the output directory. The files to be processed are limited by a file extension, output files are given the same name as the input file but assigned the specified file extension.
If required the processor will recurse down the directory tree, processing each directory.
Supports the following arguments:
If required the processor will recurse down the directory tree, processing each directory.
Usage
> java org.hoglet.tools.DirectoryProcessor [xml config file] [input directory] [input file extension] [output directory] [output file extension] [overwrite] [recurse directories]
Supports the following arguments:
Argument | Optional | Description |
xml config file | No | Is the full path to the config file for the tag, handlers and delimiters that the parser should use for processing. |
input directory | No | The input directory to process. |
input file extension | No | Limit the files to process to those with this file extension. |
output directory | No | The output directory to process. |
output file extension | No | Give the processed file this file extension. The original file extension is stripped, i.e. index.txt would become index.html. |
overwrite | Yes | Should be either: true or false. If true then the processor will overwrite the output file if it already exists. If false and the output file already exists then the output file is not overwritten and an error is returned. |
recurse directories | Yes | Should be either: true or false. If true then the processor will recurse down the directory tree (starting at the input directory of course) and process each directory. If false then only the input directory will be processed. |
Example
This assumes that you are running hoglet from the install directory using the default tag handlers config file.> java org.hoglet.tools.DirectoryProcessor data/tag-handlers.xml /home/me txt /home/me html true true