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.IComponentUiImplementation 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 theIComponentUisuch 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. Ifoptionshas an attribute that matches one of theCmdlineCommandsand the value of that attribute isTruethen the action for the matching command is executed. If there is no such attribute, then the default actioncreateis executed.CmdlineCommands.CREATEcommand triggers theCreateaction. 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_EXTat 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_DIRoption.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.argumentsand setting the optionOptions.ALLtoTrue.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_DIRdirectory).
CmdlineCommands.LISTcommand triggers theListaction. It lists information about selected and orphaned archives to standard output. Archives can be specified by the same way as for theCreateaction except the last point where theListaction does not require the optionOptions.ALLto 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.VERBOSEoption.CmdlineCommands.PURGEcommand triggers thePurgeaction. It removes all stored information about specified orphaned archives.Orphaned archives names can be passed in
IMainfContext.appEnvironment.argumentsor ifOptions.ALLisTruethen 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:
objectTakes care of execution of a user action specified on the command line.
Parameters: interfaceAccessor ( IInterfaceAccessor) – AnIInterfaceAccessorinstance.-
execute()[source]¶ Executes the user action.
Returns: Trueif the action execution was successful;Falseotherwise.
-
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
-