Commit a01c0c79 authored by Yuexi Ma's avatar Yuexi Ma
Browse files

Create base command processor for console.

Previously, the console has the following problems:

1. All commands were stacked in console.py, making the file very lengthy
2. Each commands had a init parser method, which needs to be called in sequence in the classes init method, which seems redundant.
3. There were no other init methods to setup a command, and there is no clean up methods as well.
4. Duplication of help functions existed for all commands.
5. Each command has no private attibutes and methods, so that they have to avoid name collision and putting private methods and fields to the console itself.
   It was hard to add complex logic for a command.

With the new command processor base, we now have clearly defined command professor base that includes setup and cleanup operations.
Common logic can now be hosted in the base class, such as default help function and ArgParser initialization.

Proof of concept:
Modification of the 'info' command shows that it can be concisely defined with only overriding the name, description fields, and Run method.

Test: make vts; run; info;

Change-Id: Id30aa00f2ebaee8201eee34f6bcef834f5e5f3ab
parent 9edabd67
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment