Skip to content
Browse files

added getNativeDefinition() to allow specifying an alternate InputDef…

…inition for help generation
  • Loading branch information...
1 parent d43963b commit 41e1cc4dd8d9c3c113252dbc966a3842ec0f34a0 @meandmymonkey meandmymonkey committed
Showing with 15 additions and 2 deletions.
  1. +15 −2 Command/Command.php
View
17 Command/Command.php
@@ -299,6 +299,19 @@ public function getDefinition()
}
/**
+ * Gets the InputDefinition to be used to create XML and Text representations of this Command.
+ *
+ * Can be overridden to provide the original command representation when it would otherwise
+ * be changed by merging with the application InputDefinition.
+ *
+ * @return InputDefinition An InputDefinition instance
+ */
+ protected function getNativeDefinition()
+ {
+ return $this->getDefinition();
+ }
+
+ /**
* Adds an argument.
*
* @param string $name The argument name
@@ -531,7 +544,7 @@ public function asText()
$messages[] = '<comment>Aliases:</comment> <info>'.implode(', ', $this->getAliases()).'</info>';
}
- $messages[] = $this->definition->asText();
+ $messages[] = $this->getNativeDefinition()->asText();
if ($help = $this->getProcessedHelp()) {
$messages[] = '<comment>Help:</comment>';
@@ -572,7 +585,7 @@ public function asXml($asDom = false)
$aliasXML->appendChild($dom->createTextNode($alias));
}
- $definition = $this->definition->asXml(true);
+ $definition = $this->getNativeDefinition()->asXml(true);
$commandXML->appendChild($dom->importNode($definition->getElementsByTagName('arguments')->item(0), true));
$commandXML->appendChild($dom->importNode($definition->getElementsByTagName('options')->item(0), true));

0 comments on commit 41e1cc4

Please sign in to comment.
Something went wrong with that request. Please try again.