1
0
mirror of https://github.com/pattern-lab/patternlab-php.git synced 2025-03-15 19:39:42 +01:00

make sure option info only shows when there are options

This commit is contained in:
Dave Olsen 2014-03-18 11:03:50 -04:00
parent 157b636574
commit 6ae174c3f0

View File

@ -220,25 +220,29 @@ class Console {
// write out the generic usage info
$this->writeLine($commandLongUC." Command Options",true);
$this->writeLine("Usage:");
$this->writeLine(" php ".$this->self." --".$commandLong." ".$optionList,true);
$this->writeLine("Available options:");
$this->writeLine(" php ".$this->self." --".$commandLong."|-".$commandShort." ".$optionList,true);
// write out the options
foreach ($commandOptions as $option => $attributes) {
$spacer = $this->getSpacer($lengthLong,$attributes["optionLongLength"]);
$this->writeLine(" --".$attributes["optionLong"].$spacer."(-".$attributes["optionShort"].") ".$attributes["optionDesc"]);
// write out the available options
if (count($commandOptions) > 0) {
$this->writeLine("Available options:");
foreach ($commandOptions as $option => $attributes) {
$spacer = $this->getSpacer($lengthLong,$attributes["optionLongLength"]);
$this->writeLine(" --".$attributes["optionLong"].$spacer."(-".$attributes["optionShort"].") ".$attributes["optionDesc"]);
}
$this->writeLine("");
}
$this->writeLine("");
$this->writeLine("Help:");
$this->writeLine(" ".$commandHelp,true);
$this->writeLine(" Samples:",true);
// write out the samples
foreach ($commandOptions as $option => $attributes) {
$this->writeLine(" ".$attributes["optionSample"]);
$this->writeLine(" php ".$this->self." --".$commandLong." --".$attributes["optionLong"]);
$this->writeLine(" php ".$this->self." -".$commandShort." -".$attributes["optionShort"],true);
if (count($commandOptions) > 0) {
$this->writeLine(" Samples:",true);
foreach ($commandOptions as $option => $attributes) {
$this->writeLine(" ".$attributes["optionSample"]);
$this->writeLine(" php ".$this->self." --".$commandLong." --".$attributes["optionLong"]);
$this->writeLine(" php ".$this->self." -".$commandShort." -".$attributes["optionShort"],true);
}
}
}