Commit Graph

27 Commits

Author SHA1 Message Date
c8848aec47
Updated soypakcli.py 2023-08-09 14:05:40 +01:00
63d6c4b31c
Updated logging in command.py 2023-08-07 14:42:59 +01:00
11435da41b
Updated help.py
- Changed class layout to use updated command registry.
    - Class uses the decorator function with appropriate arugments.
2023-08-02 15:42:26 +01:00
c8abba3165
Updated commands.py
- 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
2023-08-02 14:20:20 +01:00
cb7ea6c347
Create logger before modules are imported 2023-08-02 14:17:16 +01:00
f52b579b13
Added logging to module 2023-07-30 16:48:58 +01:00
7500d5424f
Updated help.py
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.
2023-07-30 16:43:48 +01:00
d7a2aa489b
Added pyproject.toml 2023-07-30 16:43:12 +01:00
7666e7394a
Updated commands.py
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.
2023-07-30 16:06:20 +01:00
d480d75de2
Removed setup.py for pyproject.toml 2023-07-30 16:04:16 +01:00
e12fa43ed1
Renamed _soypak.py -> soypak-cli.py
Also added logging to file.
2023-07-30 15:57:12 +01:00
9099b4aa1e
Udated README.md 2023-07-30 13:30:15 +01:00
ef81c93d52
Updated README.md
Added a TODO list
2023-07-05 22:26:39 +01:00
d10c635982
Updated help.py
Fixed type for annotation in init method
2023-07-05 21:48:00 +01:00
94d6f8f933
Updated soypakcli.py
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
2023-07-05 20:24:27 +01:00
6f8ef85d85
Updated parser.py
- 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).
2023-07-05 19:05:25 +01:00
52044e0b16
Added help.py
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`.
2023-07-05 19:01:37 +01:00
500ddd2a77
Added command.py
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`.
2023-07-05 18:35:00 +01:00
5700eea0ed
Updated _soypak.py 2023-07-05 18:34:26 +01:00
ce8365ebe7
Added soypakcli.py
The soypak CLI interface module which handles arg parsing and the initialisation of soypak.
2023-07-04 20:52:59 +01:00
23fd41ce03
Added parser.py
Added soypak parser module using argparse to parse arguments, also have a custom help screen.
2023-07-04 20:51:45 +01:00
14864aff8f
Added _soypak.py
Main entry script for soypak. Preinitalisation will occur here and runs the cli modules.
2023-07-04 20:50:40 +01:00
50f11060e6
Added __version__.py
Added information about soypak
2023-07-04 20:49:48 +01:00
419be2811c
Updated setup.py 2023-07-04 20:47:51 +01:00
b7f572aaab
Added icon logos 2023-07-02 13:46:41 +01:00
9521184a4c
Updated README.md
added icon
2023-07-02 13:45:46 +01:00
f65deb2285
Initial commit 2023-07-01 21:32:54 +01:00