g5
.
Code is PSR-4 (namespace hierarchy corresponds to directory hierarchy, like in java).
Top-level namespace (
g5
) is located in src/
.
Another top-level namespace is used (
vendor
), located in vendor/
.
The code does not use composer or other dependency manager, vendor code is copied in
vendor/
directory and versioned with the program.
All transformations on data are done in namespace
g5\commands
.
Association CLI - executed code
The command line interface (CLI) is handled byrun-g5.php
.
The code uses the parameters given to the CLI to find a class of namespace
g5\commands
implementing the Command
interface.
For details about this mechanism, see comments of class g5\app\Run.
Example:
php run-g5.php ertel sport look datetriggers the execution of
g5\commands\ertel\sport\look::execute(['date'])
One exception
This mechanism proved to be sufficient for most cases. It is convenient because it permits to add new commands which can be used directly without having to change a configuration, but couldn't fill the need to handle Gauquelin files of series A. For example, to have the ability to issue commands likephp run-g5.php gauq A1 tmp2db
php run-g5.php gauq A2 tmp2db
would impose namespace
gauq
to have a sub-namespace A1
and a sub-namespace A2
etc.
So if the first parameter is
gauq
, the association between the parameters given to the CLI and the command to execute is handled by g5\commands\gauq\GauqCommand
.