Command@get_command() method now allows for the app to error if a
command is unrecognised. This is used by commands such as Help, when a
help message cannot be displayed for an unrecognised command.
Changed the way help summary messages are accessed from commands.
soypakcli is responsible for registering all commands, parsing and
invoking the command to run.
- global optional flags are explicitly check first, regardless of the
number of args.
- if there is no command, the program displays the help message and
dies.
- fetches the command class for the identified soypak command and
initialised the class command.
- SoypakCLI@run_command: invokes the `run()` method of a command class
- Changed class@SoypakParser => class@_SoypackParser
- class@SoypakParser is now a singleton pattern which handles
class@_SoypakParser.
- SoypakParser@add_action_command (static method): add a command to the
action group (argparser).
Added the soypak help command. When called, it will provide the user
with help information about the soypak command(s) provided as arguments.
- Implements a `__doc__` attribute with summar and usage.
- Overrides the `run()` method from `Command` when inherited.
- Inherits `command.Command` and metaclass `RegisterCommand`.
Module is responsible for allowing the creation, registering and
initilisation of soypak commands.
Added class@RegisterCommand:
- used by command classes as a metaclass. Will be auto-invoked upon
the class' declaration.
- checks if a command is registered already with an existing name.
- uses the class' `__doc__` attribute to register an entry on the
help display message with name and summary.
Added class@Command:
- Inherited by command classes.
- Keeps record of the registered commands and the instance of the
class which can then be invoked during `get_command()`.
- Command@get_command (static method): find and return an
initialised instance of a command that has been registered.
Otherwise return `None`.
- Command@run (virtual): to be implemented on a child class of
`Command`.