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 the IComponentUi such that it uses standard output and standard error as the user interface. The instance is exposed as IComponentInterface.

presentLine(line)[source]

See: IComponentUi.presentLine().

run()[source]

Executes an action defined for the specified command.

Command is read from the IMainfContext.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.

CmdlineCommands.CREATE command triggers the Create 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 by Options.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 option Options.ALL to True.

    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 the List action. It lists information about selected and orphaned archives to standard output. Archives can be specified by the same way as for the Create action except the last point where the List action does not require the option Options.ALL to be True. 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 the Purge action. It removes all stored information about specified orphaned archives.

Orphaned archives names can be passed in IMainfContext.appEnvironment.arguments or if Options.ALL is True then all orphaned archives are processed.

See also: IComponent.run().

showError(msg)[source]

See: IComponentUi.showError().

showInfo(msg)[source]

See: IComponentUi.showInfo().

showNotification(msg)[source]

See: IComponentUi.showNotification().

showVerbose(msg)[source]

See: IComponentUi.showVerbose().

showWarning(msg)[source]

See: IComponentUi.showWarning().

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) – An IInterfaceAccessor 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