Now uses transaction module.
Conditional statement changed for checking if an argv is a bottle file:
- Initially check for file suffix. Inform if file detected.
- Then check if bottle file exists on the system. Report
accordingly.
- Attempt to load the bottle file as a package. Fail if otherwise
unable to do this. Otherwise inform that it was loaded okay.
Check if we have anything to install. Inform and exit if we have
nothing.
Start a new transaction:
- This is to give greater control and ensure the goal is met. A
transaction is initialised with a goal, and `.apply()` will
perform this goal.
- Compute the system dependencies with `.compute()`. Any
dependencies which soypak can install (recognised in the packages
database), will not be included here. Report if we have
dependencies.
- Apply the transaction to the system with `.apply()`. This will be
dependent on the goal set.
- Check for problems when applying the transaction with `.problems()`.
- Finally commit the transaction to record.
- Added global variable for logging.
- Removed `class@RegisterCommand` metaclass.
- Replaced with decorator function.
- Added `class@CommandHelpStruct`.
- Basic struct to define rigid structure of the help message of a
command. Uses `__slots__` over instance dictionary.
- Changed type annotations for removal of metaclass.
- Added logging.
- Created decorator function `register_command()`.
- Used to register a new command class (replaces metaclass)
- Guarantees a name and doc dunder attribute is defined.
- Registry now ensures that a command isn't already defined with the
same registry name.
- Must be invoked with parens
Added implementation to run command. For every argument give (a
command), the help message for that command is displayed.
Renamed `__cmd_name__` to `name`, which will be standard across all
commands.
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`.