consolekit.commands
Customised click commands and command groups.
New in version 0.8.0.
Classes:
|
Subclass of |
|
Subclass of |
|
Subclass of |
Mixin class for |
|
|
Subclass of |
|
Subclass of |
Mixin class for |
|
|
Subclass of |
-
class
ContextInheritingGroup
(name=None, commands=None, **attrs)[source] Bases:
Group
Subclass of
click.Group
whose children inherit itscontext_settings
.The group’s commands can be given different context settings by passing the
context_settings
keyword argument tocommand()
andgroup()
as normal.New in version 1.1.0.
Methods:
command
(*args, **kwargs)A shortcut decorator for declaring and attaching a command to the group.
group
(*args, **kwargs)A shortcut decorator for declaring and attaching a group to the group.
-
command
(*args, **kwargs)[source] A shortcut decorator for declaring and attaching a command to the group.
This takes the same arguments as
click.command()
but immediately registers the created command with this instance by calling intoclick.Group.add_command()
.
-
group
(*args, **kwargs)[source] A shortcut decorator for declaring and attaching a group to the group.
This takes the same arguments as
click.group()
but immediately registers the created group with this instance by calling intoclick.Group.add_command()
.
-
-
class
MarkdownHelpCommand
[source] -
class
MarkdownHelpGroup
[source] Bases:
MarkdownHelpMixin
Subclasses of
click.Command
andclick.Group
which treat the help text as markdown and print a rendered representation.Tested in Gnome Terminal and Terminator (both libVTE-based), and PyCharm. libVTE has the best support. PyCharm’s support for italics and strikethrough is poor. Support on Windows is, as expected, poor.
Not tested on other terminals, but contributions are welcome to improve support.
New in version 0.8.0.
-
class
MarkdownHelpMixin
[source] Bases:
object
Mixin class for
click.Command
andclick.Group
which treats the help text as markdown and prints a rendered representation.See also
Tip
This can be combined with groups such as
SuggestionGroup
.Tested in Gnome Terminal and Terminator (both libVTE-based), and PyCharm. libVTE has the best support. PyCharm’s support for italics and strikethrough is poor. Support on Windows is, as expected, poor.
Not tested on other terminals, but contributions are welcome to improve support.
New in version 0.8.0.
-
format_help_text
(ctx, formatter)[source] Writes the help text to the formatter if it exists.
- Parameters
ctx (
Context
)formatter (
HelpFormatter
)
-
-
class
RawHelpCommand
[source] -
class
RawHelpGroup
[source] Bases:
RawHelpMixin
Subclasses of
click.Command
andclick.Group
which leave the help text unformatted.New in version 0.8.0.
-
class
RawHelpMixin
[source] Bases:
object
Mixin class for
click.Command
andclick.Group
which leaves the help text unformatted.See also
Tip
This can be combined with groups such as
SuggestionGroup
.New in version 0.8.0.
-
format_help_text
(ctx, formatter)[source] Writes the help text to the formatter if it exists.
- Parameters
ctx (
Context
)formatter (
HelpFormatter
)
-
-
class
SuggestionGroup
(name=None, commands=None, **attrs)[source] Bases:
ContextInheritingGroup
Subclass of
click.Group
which suggests the most similar command if the command is not found.Changed in version 0.8.0: Moved to
consolekit.commands
.Changed in version 1.1.0: Now inherits from
ContextInheritingGroup