Templates CLI

The template engine can be invoked from the command line:

  java net.sf.csutils.groovy.Main
    -csUrl http://127.0.0.1:53305/CentraSite/CentraSite
    -csUser MyUsername
    -csPassword MyPassword
    -inputFile SomeFile.txt
    -outputFile AnotherFile.txt
    -templateType gstring

This example would read a plain text template from SomeFile.txt, process it, and write the output to AnotherFile.txt. (Of course, you've got to enter the complete command as a single line.)

Available options

Options are introduced by one or two dashs, like this:

    -csUrl http://127.0.0.1:53305/CentraSite/CentraSite
    --csUrl http://127.0.0.1:53305/CentraSite/CentraSite

It doesn't matter, which version you choose. The following options are available in the command line interface:

Option nameDescription
csPasswordSets the CentraSite password. Example: -csPassword MyPassword
csUrlSets the CentraSite URL. Example: -csUrl http://127.0.0.1:53305/CentraSite/CentraSite
csUserSets the CentraSite user name. Example: -csUser MyDomain MyUsername
helpPrints the usage description and exits with error status. Example: -help
inputEncodingSets the input templates encoding; defaults to UTF8. Example: -inputEncoding CP-1252
inputFileSets the input file, this option is mutually exclusive with inputUrl. Example: -inputFile MyFile.txt If neither inputFile, nor inputUrl are given, then System.in is used.
inputUrlSets the input URL, this option is mutually exclusive with inputFile. Example: -inputURL http://127.0.0.1/MyFile.txt
outputEncodingSets the output files encoding; defaults to UTF8. Example: -outputEncoding CP-1252
outputFileSets the output file. Example: -outputFile OtherFile.txt May be omitted, in which case System.out is used.
templateTypeSets the template type. Available types are simple, gstring (Default), gxml (Standard Groovy XML template engine), and xml (Advances CSUtils XML template engine). Example: -templateType xml