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:
GroupSubclass of
click.Groupwhose children inherit itscontext_settings.The group’s commands can be given different context settings by passing the
context_settingskeyword 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:
MarkdownHelpMixinSubclasses of
click.Commandandclick.Groupwhich 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:
objectMixin class for
click.Commandandclick.Groupwhich 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:
RawHelpMixinSubclasses of
click.Commandandclick.Groupwhich leave the help text unformatted.New in version 0.8.0.
-
class
RawHelpMixin[source] Bases:
objectMixin class for
click.Commandandclick.Groupwhich 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:
ContextInheritingGroupSubclass of
click.Groupwhich 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