Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion craft_cli/helptexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def get_command_help(
else:
raise RuntimeError("Internal inconsistency in commands groups")
other_command_names = [
c.name for c in command_group.commands if not isinstance(command, c)
c.name for c in command_group.commands if c.name != command.name
]

if output_format == OutputFormat.markdown:
Expand Down
5 changes: 3 additions & 2 deletions tests/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def create_command(
hidden: bool = False,
overview: str = "",
class_name: str = "MyCommand",
) -> type["BaseCommand"]:
base_class: type[BaseCommand] = BaseCommand,
) -> type[BaseCommand]:
"""Helper to create commands."""
attribs = {
"name": name,
Expand All @@ -36,4 +37,4 @@ def create_command(
"needs_config": False,
"run": lambda parsed_args: None,
}
return type(class_name, (BaseCommand,), attribs)
return type(class_name, (base_class,), attribs)
5 changes: 4 additions & 1 deletion tests/unit/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,11 @@ def test_command_help_text_no_parameters(docs_url, output_format):
Multiline!
"""
)
cmd1 = create_command("somecommand", "Command one line help.", overview=overview)
cmd2 = create_command("other-cmd-2", "Some help.")
# Inherit from cmd2 to check that superclasses are treated as different commands.
cmd1 = create_command(
"somecommand", "Command one line help.", overview=overview, base_class=cmd2
)
cmd3 = create_command("other-cmd-3", "Some help.")
cmd4 = create_command("other-cmd-4", "Some help.")
command_groups = [
Expand Down