Module

cli.base

Documentation for base

Classes

BengalCommand
Custom Click command with themed help output.
1

Custom Click command with themed help output.

Inherits from click.Command

Methods 1

format_help
Format help output using our themed CLIOutput.
2 None
def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> None

Format help output using our themed CLIOutput.

Parameters 2
ctx click.Context
formatter click.HelpFormatter
BengalGroup
Custom Click group with typo detection and themed help output.
3

Custom Click group with typo detection and themed help output.

Inherits from click.Group

Methods 2

format_help
Format help output using our themed CLIOutput.
2 None
def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> None

Format help output using our themed CLIOutput.

Parameters 2
ctx click.Context
formatter click.HelpFormatter
resolve_command
Resolve command with fuzzy matching for typos.
2 tuple[str | None, c…
def resolve_command(self, ctx: click.Context, args: list[str]) -> tuple[str | None, click.Command | None, list[str]]

Resolve command with fuzzy matching for typos.

Parameters 2
ctx click.Context
args list[str]
Returns

tuple[str | None, click.Command | None, list[str]]

Internal Methods 1
_get_similar_commands
Find similar command names using simple string similarity.
2 list[str]
def _get_similar_commands(self, unknown_cmd: str, max_suggestions: int = 3) -> list[str]

Find similar command names using simple string similarity.

Parameters 2
unknown_cmd str
max_suggestions int
Returns

list[str]

Functions

get_aliases_for_command
Get all aliases for a canonical command name.
1 list[str]
def get_aliases_for_command(cmd_name: str) -> list[str]

Get all aliases for a canonical command name.

Parameters 1

Name Type Default Description
cmd_name str

Returns

list[str]

get_canonical_name
Get the canonical command name for an alias (or return as-is if not an alias).
1 str
def get_canonical_name(cmd_or_alias: str) -> str

Get the canonical command name for an alias (or return as-is if not an alias).

Parameters 1

Name Type Default Description
cmd_or_alias str

Returns

str

_sanitize_help_text
Remove Commands section from help text to avoid duplication. Click automatically generates a Comma…
1 str
def _sanitize_help_text(text: str) -> str

Remove Commands section from help text to avoid duplication.

Click automatically generates a Commands section, so we remove it from the docstring to avoid showing it twice.

Parameters 1

Name Type Default Description
text str

Returns

str