zanata/zanata-client — pull request #2 by davidmason (2013-10-31 03:59:42+00:00)
Title: Add command hooks

This allows command hooks to be defined in zanata.xml to run arbitrary commands before and/or after zanata client commands. For example, the following elements within the top-level `` element will generate a .pot file from a man page before push, clean up the generated file after push, and will generate a translated german man page after pull then remove all downloaded .po files.

```xml

po4a-gettextize -f man -m google-chrome.1 -p goog-chrome.pot
rm -f goog-chrome.pot

po4a-translate -f man -m google-chrome.1 -p trans/de/goog-chrome.po -l google-chrome.de.1 --keep 1
rm -rf trans

```

Multiple commands of the same type within a hook will be run in the order that they appear. e.g. when running pull with the above config, po4a will always run before rm. If any of these commands fails, the whole operation is aborted. e.g. when running push, if po4a fails then push and rm will not be run, and if push fails then rm will not be run.

Note that some commands (such as 'cd') do not work when run from Java.

Output from commands is not displayed or logged yet, but the return value is displayed.