diff --git a/cleo/commands/list_command.py b/cleo/commands/list_command.py index e4fd9d00..1adeeb31 100644 --- a/cleo/commands/list_command.py +++ b/cleo/commands/list_command.py @@ -36,7 +36,10 @@ def handle(self) -> int: from cleo.descriptors.text_descriptor import TextDescriptor TextDescriptor().describe( - self._io, self.application, namespace=self.argument("namespace") + self._io, + self.application, + namespace=self.argument("namespace"), + definition=self.definition, ) return 0 diff --git a/cleo/descriptors/text_descriptor.py b/cleo/descriptors/text_descriptor.py index 09b9da16..cc6e88b1 100644 --- a/cleo/descriptors/text_descriptor.py +++ b/cleo/descriptors/text_descriptor.py @@ -160,6 +160,7 @@ def _describe_application(self, application: Application, **options: Any) -> Non described_namespace = options.get("namespace") description = ApplicationDescription(application, namespace=described_namespace) + definition = options.pop("definition", application.definition) help_text = application.help if help_text: @@ -168,7 +169,7 @@ def _describe_application(self, application: Application, **options: Any) -> Non self._write("Usage:\n") self._write(" command [options] [arguments]\n\n") - self._describe_definition(Definition(application.definition.options), **options) + self._describe_definition(Definition(definition.options), **options) self._write("\n") self._write("\n") diff --git a/tests/fixtures/application_run1.txt b/tests/fixtures/application_run1.txt index 94356a39..7a19fa39 100644 --- a/tests/fixtures/application_run1.txt +++ b/tests/fixtures/application_run1.txt @@ -4,6 +4,7 @@ Usage: command [options] [arguments] Options: + -V, --version Display this application version. -h, --help Display help for the given command. When no command is given display help for the list command. -q, --quiet Do not output any message. --ansi Force ANSI output.