6.2 Invoking Cows

The simplest way to invoke Cows is as follows:

cows input-file output-file

Here input-file is the file containing HTML code with Cows additional tags; it usually ends in .cws; output-file is the output file name, which usually ends in .html.

6.2.1 Cows Options

Cows supports both traditional single-letter options and mnemonic long option names. Abbreviations for option names are allowed as long as they are unique. The following are equivalent.

cows -rrep.txt input.cws output.html
cows --report=rep.txt input.cws output.html

Here is a list of options that can be used with Cows, alphabetized by short option.

-A, --accessibility

Display informations about accessibility issues related to Cows.

-b, --brief

Display output in a compact format. The amount of messages won't change, they will only be shorter. Visually impaired users relying on a speech version of shell's output may find this flag useful since large amounts of output can slow down work.

-D definition, --define=definition

Define a variable before running Cows; Cows will treat this variable as if it were defined at the beginning of input-file. Definition can be a standard Cows variable assignment (variable=value) or simply a variable name; in this case variable will be assigned an empty string.

-d directory, --root-dir=directory

Set site's root directory; Cows need this information in order to adjust links via the linkadjust () function. If not provided, Cows will use the launching directory. This default behavior is the right one if you use Cows-mkgen and Make to manage your site.

-E, --fatal-warnings

Stop execution after first warning (default behavior is to give an advice and continue running). It can be useful when your site has been released (I hope no warning will be present at that stage) and you want to be sure to catch any inaccuracy during maintenance and upgrading.

-h, --help

Display help message and exit.

-i, --ignore-errors

Keep running after errors.

-N, --noext-error

Don't execute external scripts or commands; raise an error instead

-n, --noext-warning

Don't execute external scripts or commands; raise a warning instead

-p, --parents

Make parent directories as needed; especially useful for branch sites, when destination directories don't exist yet.

-q, --quiet

Same as `--silent'.

-r [file], -report[=file]

Produce a report of what have been done and append it to file. If you don't provide a file name, report is printed to stderr.

-s, --silent

Don't print informational messages.

-V, --version

Display the version number of Cows and exit.

-v, --verbose

Produce a more verbose description.

6.2.2 Examples on Invoking Cows

cows - -

Read standard input and write to standard output; can be useful to try some basic operation with Cows without editing files.

cows input.cws output.html

Read file input.cws and write output to output.html

cows -define version input.cws output.html

The same as above, but a variable called version is defined within input.cws.

cows -define version="std" input.cws output.html

The same as above, but value std is assigned to version.

cows -define string="Some \"Text\" Goes Here" - -

Some "Text" Goes Here is assigned to string; notice the backslashes used to escape quotes.

cows input.cws output.html && lynx output.html

Read file input.cws and write output to output.html; if Cows exits successfully the Lynx text browser is run to see the result.

cows input.cws - | grep "Some text" | wc -l

Read file input.cws and send output to the grep command, in order to extract lines containing string "Some text"; then send these lines to command wc in order to count them and display the result.

cows input.cws - | tee output.html | grep "Some text" | wc -l

The same as above but output is both written to file output.html and processed by grep and wc.

This manual can be downloaded from http://www.g-cows.org/.