AutoArchive._ui._cmdline._core¶
Cmdline UI component internal package.
Modules¶
cmdline_ui_component¶
CmdlineUiComponent
class.
-
class
AutoArchive._ui._cmdline._core.cmdline_ui_component.
CmdlineUiComponent
(interfaceAccessor)[source]¶ Bases:
AutoArchive._mainf.icomponent.IComponent
,AutoArchive._mainf.icomponent_ui.IComponentUi
Implementation of the command-line user interface.
Class serves as the component of Mainf framework and uses the
run()
method as an entry point for executing user actions specified on the command-line. It implements theIComponentUi
such that it uses standard output and standard error as the user interface. The instance is exposed asIComponentInterface
.-
run
()[source]¶ Executes an action defined for the specified command.
Command is read from the
IMainfContext.appEnvironment.options
. Ifoptions
has an attribute that matches one of theCmdlineCommands
and the value of that attribute isTrue
then the action for the matching command is executed. If there is no such attribute, then the default actioncreate
is executed.CmdlineCommands.CREATE
command triggers theCreate
action. It takes all specified archive specification files and for each it creates a backup using Archiving component. Archive specification files can be specified by following ways:By archive names passed in
IMainfContext.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 byOptions.ARCHIVE_SPECS_DIR
option.By paths to archive specification files passed in
IMainfContext.appEnvironment.arguments
.A path must end with the string defined by
ConfigConstants.ARCHIVE_SPEC_EXT
.By passing empty
IMainfContext.appEnvironment.arguments
and setting the optionOptions.ALL
toTrue
.In this case the action shall be executed for all known archives as served by Configuration component (typically all archive specification files in
Options.ARCHIVE_SPECS_DIR
directory).
CmdlineCommands.LIST
command triggers theList
action. It lists information about selected and orphaned archives to standard output. Archives can be specified by the same way as for theCreate
action except the last point where theList
action does not require the optionOptions.ALL
to beTrue
. Orphaned archives are always listed.List of orphaned archives is obtained by following operation: from the list of stored archives (as served by Archiving component) is subtracted the unique list of valid selected archives and valid configured archives.
Output has two possible formats depending on the
Options.VERBOSE
option.CmdlineCommands.PURGE
command triggers thePurge
action. It removes all stored information about specified orphaned archives.Orphaned archives names can be passed in
IMainfContext.appEnvironment.arguments
or ifOptions.ALL
isTrue
then all orphaned archives are processed.See also:
IComponent.run()
.
-
showError
(msg)[source]¶ See:
IComponentUi.showError()
.
-
showInfo
(msg)[source]¶ See:
IComponentUi.showInfo()
.
-
messageShown
= <AutoArchive._py_additions.event object>¶
-
verbosity
¶ See:
IComponentUi.verbosity
.
-
_user_action_executor¶
_UserActionExecutor
class.
-
class
AutoArchive._ui._cmdline._core._user_action_executor.
_UserActionExecutor
(interfaceAccessor)[source]¶ Bases:
object
Takes care of execution of a user action specified on the command line.
Parameters: interfaceAccessor ( IInterfaceAccessor
) – AnIInterfaceAccessor
instance.-
execute
()[source]¶ Executes the user action.
Returns: True
if the action execution was successful;False
otherwise.
-
action
¶ Gets the user action.
Return type: str
-
processedArchSpec
¶ Gets currently processed archive specification file.
Note
The returned value can be either the archive specification file name or path to it.
Rtype archSpec: str
-