plainbox.impl.commands.session
– run sub-command¶
-
class
plainbox.impl.commands.session.
SessionInvocation
(ns, provider_loader)[source]¶ Bases:
object
Invocation of the ‘plainbox session’ command.
Variables: ns – The argparse namespace obtained from SessionCommand
-
class
plainbox.impl.commands.session.
SessionCommand
(provider_loader)[source]¶ Bases:
plainbox.impl.commands.PlainBoxCommand
session management commands
This command can be used to list, show and remove sessions owned by the current user.
@EPILOG@
Each session has a small amount of meta-data that is available for inspection. Each session has an application identifier (set by the application that created that session), a title, that is human readable piece of text that helps to distinguish sessions, and a set of flags.
Flags are particularly useful for determining what is the overall state of any particular session. Two flags are standardized (other flags can be used by applications): incomplete and submitted. The ‘incomplete’ flag is removed after all desired jobs have been executed. The ‘submitted’ flag is set after a submission is made using any of the transport mechanisms.
-
add_subcommand
(subparsers)¶ Add a parser to the specified subparsers instance.
Returns: The new parser for the added subcommand This command works by convention, depending on
get_command_name(), :meth:`get_command_help()
,get_command_description()
andget_command_epilog()
.
-
autopager
()¶ Enable automatic pager.
This invokes
autopager()
which wraps execution in a pager program so that long output is not a problem to read. Do not call this in interactive commands.
-
get_command_description
()¶ Get a multi-line description string associated with this command, as seen on command line.
The description is printed after command usage but before argument and option definitions.
Returns: self.description, if defined Returns: A substring of the class docstring between the first line (which goes to get_command_help()
) and the string@EPILOG@
, if present, or the end of the docstring, if any.Returns: None, otherwise
-
get_command_epilog
()¶ Get a multi-line description string associated with this command, as seen on command line.
The epilog is printed after the definitions of arguments and options
Returns: self.epilog, if defined Returns: A substring of the class docstring between the string @EPILOG
and the end of the docstring, if definedReturns: None, otherwise
-
get_command_help
()¶ Get a single-line help string associated with this command, as seen on command line.
Returns: self.help, if defined Returns: The first line of the docstring of this class, if any Returns: None, otherwise
-
get_command_name
()¶ Get the name of the command, as seen on command line.
Returns: self.name, if defined Returns: lower-cased class name, with the string “command” stripped out
-
get_gettext_domain
()¶ Get the gettext translation domain associated with this command.
The domain will be used to translate the description, epilog and help string, as obtained by their respective methods.
Returns: self.gettext_domain, if defined Returns: None, otherwise. Note that it will cause the string to be translated with the globally configured domain.
-
get_localized_docstring
()¶ Get a cleaned-up, localized copy of docstring of this class.
-
gettext_domain
= 'plainbox'¶
-
register_arguments
(parser)¶ Implement to customize which arguments need to be added to a parser.
This method differs from register_parser() in that it allows commands which implement it to be invoked directly from a tool class (without being a subcommand that needs to be selected). If implemented it should be used from within
register_parser()
to ensure identical behavior in both cases (subcommand and tool-level command)
-