Make help output help2man-friendly

These changes follow regular advices for CLI output and allow help2man
to produce a meaningful manpage out of it.
This commit is contained in:
David Prévot 2014-09-04 16:26:30 -04:00 committed by Nikita Popov
parent 30abe062f2
commit 69c00ebbe4

View File

@ -84,25 +84,20 @@ foreach ($files as $file) {
function showHelp($error) { function showHelp($error) {
die($error . "\n\n" . die($error . "\n\n" .
<<<OUTPUT <<<OUTPUT
Usage: Usage: php php-parse.php [operations] file1.php [file2.php ...]
or: php php-parse.php [operations] "<?php code"
php php-parse.php [operations] file1.php [file2.php ...] Turn PHP source code into an abstract syntax tree.
The file arguments can also be replaced with a code string:
php php-parse.php [operations] "<?php code"
Operations is a list of the following options (--dump by default): Operations is a list of the following options (--dump by default):
--dump -d Dump nodes using NodeDumper -d, --dump Dump nodes using NodeDumper
--pretty-print -p Pretty print file using PrettyPrinter\Standard -p, --pretty-print Pretty print file using PrettyPrinter\Standard
--serialize-xml Serialize nodes using Serializer\XML --serialize-xml Serialize nodes using Serializer\XML
--var-dump var_dump() nodes (for exact structure) --var-dump var_dump() nodes (for exact structure)
--resolve-names -N Resolve names using NodeVisitor\NameResolver -N, --resolve-names Resolve names using NodeVisitor\NameResolver
--with-column-info -c Show column-numbers for errors (if available) -c, --with-column-info Show column-numbers for errors (if available)
Example: Example:
php php-parse.php -d -p -N -d file.php php php-parse.php -d -p -N -d file.php
Dumps nodes, pretty prints them, then resolves names and dumps them again. Dumps nodes, pretty prints them, then resolves names and dumps them again.