Cmdline UI component.
Package implements command-line user interface.
UserActionExecutor class.
Bases: builtins.object
Takes care of execution of a user action specified on the command line.
Parameters: |
|
---|
Executes an action defined for the specified command for specified archive specification files.
Command is read from the ApplicationContext.appEnvironment.options. If options has an attribute that matches one of the CmdlineCommands and the value of that attribute is True then the action for the matching command is executed. If there is no such attribute, then the default action create is executed.
Archive specification files can be specified by following ways:
By archive names passed in ApplicationContext.appEnvironment.arguments.
Archive name can not contain the string defined by ConfigConstants.ARCHIVE_SPEC_EXT at the end otherwise it would be taken as the path to an archive specification file. Archive specification files corresponding to the names are looked up in the path defined by Options.ARCHIVE_SPECS_DIR option.
By paths to archive specification files passed in ApplicationContext.appEnvironment.arguments.
A path must end with the string defined by ConfigConstants.ARCHIVE_SPEC_EXT.
Returns: | True if the action execution was successful; False otherwise. |
---|
Bases: builtins.object
Takes care of execution of a user action specified on the command line.
Parameters: |
|
---|
Executes an action defined for the specified command for specified archive specification files.
Command is read from the ApplicationContext.appEnvironment.options. If options has an attribute that matches one of the CmdlineCommands and the value of that attribute is True then the action for the matching command is executed. If there is no such attribute, then the default action create is executed.
Archive specification files can be specified by following ways:
By archive names passed in ApplicationContext.appEnvironment.arguments.
Archive name can not contain the string defined by ConfigConstants.ARCHIVE_SPEC_EXT at the end otherwise it would be taken as the path to an archive specification file. Archive specification files corresponding to the names are looked up in the path defined by Options.ARCHIVE_SPECS_DIR option.
By paths to archive specification files passed in ApplicationContext.appEnvironment.arguments.
A path must end with the string defined by ConfigConstants.ARCHIVE_SPEC_EXT.
Returns: | True if the action execution was successful; False otherwise. |
---|
CmdlineUi class.
Bases: builtins.object
Implementation of the command-line user interface.
Provides basic methods for showing messages of various importance to a user. It uses standard output and standard error as the user interface.
Parameters: |
|
---|
Present a line of text to the user.
Note
The verbosity level has no effect on presenting the line.
Parameters: | line (str) – The text that shall be presented to the user. |
---|
Present a line consisting of multiple fields of text to the user.
Note
The verbosity level has no effect on presenting the line.
Parameters: | multiFieldLine (MultiFieldLine) – Line that shall be presented. |
---|
Sets currently processed archive specification file.
Parameters: | archSpec (str) – The archive specification file name or path to it. |
---|
Show an error message to (UiMessageKinds.Error) the user.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show an information message (UiMessageKinds.Info) to the user.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show an unintrusive notification message (UiMessageKinds.Notification) to the user.
Note
If user interface implementation does not have means to support notifications then it should be presented to the user similarly as showInfo().
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show a verbose-type message (UiMessageKinds.Verbose) to the user.
Verbose messages should be shown only if user enables it. Although this method can be called regardless of current verbosity level, the concrete implementation can decide whether it will be shown or not if verbosity level is 0. It is not recommended to call this method if verbosity level is 0 due to performance reasons. Current verbosity level can be obtained via verbosity property.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show a warning message (UiMessageKinds.Warning) to the user.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Gets the verbosity level.
If verbosity level is VerbosityLevels.Quiet only messages of kind UiMessageKinds.Error are shown. For level VerbosityLevels.Normal all messages kinds except UiMessageKinds.Verbose are shown. For level VerbosityLevels.Verbose all message kinds are shown.
Return type: | VerbosityLevels |
---|
Bases: builtins.object
Implementation of the command-line user interface.
Provides basic methods for showing messages of various importance to a user. It uses standard output and standard error as the user interface.
Parameters: |
|
---|
Present a line of text to the user.
Note
The verbosity level has no effect on presenting the line.
Parameters: | line (str) – The text that shall be presented to the user. |
---|
Present a line consisting of multiple fields of text to the user.
Note
The verbosity level has no effect on presenting the line.
Parameters: | multiFieldLine (MultiFieldLine) – Line that shall be presented. |
---|
Sets currently processed archive specification file.
Parameters: | archSpec (str) – The archive specification file name or path to it. |
---|
Show an error message to (UiMessageKinds.Error) the user.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show an information message (UiMessageKinds.Info) to the user.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show an unintrusive notification message (UiMessageKinds.Notification) to the user.
Note
If user interface implementation does not have means to support notifications then it should be presented to the user similarly as showInfo().
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show a verbose-type message (UiMessageKinds.Verbose) to the user.
Verbose messages should be shown only if user enables it. Although this method can be called regardless of current verbosity level, the concrete implementation can decide whether it will be shown or not if verbosity level is 0. It is not recommended to call this method if verbosity level is 0 due to performance reasons. Current verbosity level can be obtained via verbosity property.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Show a warning message (UiMessageKinds.Warning) to the user.
See also: verbosity.
Parameters: | msg (str) – The message that should be shown to the user. |
---|
Gets the verbosity level.
If verbosity level is VerbosityLevels.Quiet only messages of kind UiMessageKinds.Error are shown. For level VerbosityLevels.Normal all messages kinds except UiMessageKinds.Verbose are shown. For level VerbosityLevels.Verbose all message kinds are shown.
Return type: | VerbosityLevels |
---|
CmdlineCommands and _CmdlineCommandsUtils static classes.
Bases: builtins.object
Constants for command-line command names.
Command-line commands are used to invoke program operations via a command-line argument. For example: --create will invoke a backup creation.
Note
It is not allowed to change values of these constants.
Create backup for a given archive specification file.
List all archive specification files.
Purge orphaned archive data.
Bases: builtins.object
Constants for command-line command names.
Command-line commands are used to invoke program operations via a command-line argument. For example: --create will invoke a backup creation.
Note
It is not allowed to change values of these constants.
Create backup for a given archive specification file.
List all archive specification files.
Purge orphaned archive data.
Bases: builtins.object
Various utility methods working with CmdlineCommands.
Iterator over all known commands.
Returns: | All options defined in CmdlineCommands. |
---|---|
Return type: | Iterable<str> |
Check whether a command with name commandName does exists in _CmdlineCommandsUtils.
Parameters: | commandName (str) – Name of the command which existence shall be checked. |
---|---|
Returns: | True if option with name commandName exists; False otherwise. |
Return type: | bool |