Command Autoloading
arc support dynamic loading of subcommands via the CLI.autoload()
method.
Example¶
Now we can run the timers:test
command, without importing it directly
CLI.autoload()
can accept an arbitrary number of paths to either files or directories. When given a file, it will do as above. When given a directory, it will attempt to load every file in that directory. In both cases, if no command is found, it will continue onto the next path rather than erroring.
Warning
Autoloaded Commands cannot overide commands installed by normal means. This is to prevent a user from accidentally overwriting a part of a tool they where unaware of with their own code.