Commit graph

3 commits

Author SHA1 Message Date
89e53bcc9f
refactor: update the executor lookup table
All checks were successful
Tests / test (pull_request) Successful in 16s
REUSE Compliance Check / check (push) Successful in 6s
Updated the executor lookup table by changing the map type from
map[string]Executor to map[string]func(string, bool, []string) error in
order to reduce the cost of initialising the map.

Previously the map initialised all the executors despite only needing
to run the single executor called by the command. The map now instead
maps the command to the function of type
'func(string, bool, []string) error' that will initialise and run the
executor called by the command. As a result of the change, the
Executor interface is no longer needed and has been removed.

PR: #57
2024-08-21 18:44:04 +01:00
3c8633ff04
refactor: minimise the main package
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
Minimise the main package by moving all flag parsing to the Execute
function.
2024-08-18 07:18:57 +01:00
84091f398d
feat: add Enbas CLI schema and code generator
Summary:

- Created a custom CLI schema for Enbas which will act as the Source
  of Truth for code and document generation.
- Created a code generator which uses the schema to generate the
  executor definitions and code in the internal usage package.

Changes:

- Created the Enbas CLI schema as the Source of Truth for Enbas.
- Created the code generator that generates the executor
  definitions and code in the usage package.
- Regenerated the executor definitions using the code generator.
- Moved the custom flag value types to the new internal flag
  package.
- Created a new flag value type for the bool pointer to replace the
  flag.BoolFunc() used for the sensitive and no-color flags.
- Moved the version and build variables to the new internal version
  package to simplify the version executor.
- Created a new usage package and moved the usage functions there.
- Changed the type of the account-name flag from string to the
  internal StringSliceValue type.
2024-08-13 14:53:26 +01:00