Skip to content

Commit

Permalink
feat(commands): make --version visible in options
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed Jun 4, 2022
1 parent dd31189 commit acddb23
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cleo/commands/list_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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
3 changes: 2 additions & 1 deletion cleo/descriptors/text_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,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:
Expand All @@ -172,7 +173,7 @@ def _describe_application(self, application: Application, **options: Any) -> Non
self._write("<b>Usage:</b>\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")
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/application_run1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit acddb23

Please sign in to comment.