-
Notifications
You must be signed in to change notification settings - Fork 0
Internals
phpl is written to be powerful and offer a lot of customization while at the same time being efficient and execute as quickly as possible. This means that modules can not access all the code of the project, but only bootstrap.php
(that handles argument parsing and global stuff) and generate.php
(that supports building the prompt items).
The secret sauce here is in phpl-reload
, which processes and optimizes the prompt and the theme data into a compact chunk of code that can be quickly evaluated from phpl-generate
. Calling it without arguments is the same as calling with --all
, but you can also chose to only reprocess the --prompt
or the current --theme
. *Note that phpl-reload
is called automatically by phpl-config
if you don't pass --no-reload
.
Themes are distilled into an array of rulesets and properties, and an array of icons being override by the theme. This information is cached so no complex parsing has to take place when generating.
The modules used by the current prompt is merged and compacted while having comments, whitespace and some function calls (such as module()
and option()
) removed.
Finally, the generated theme code and prompt code is put together into ./cache/current
, and this is the file that is used by phpl-generate
to produce the prompt. This file generally lands at about ~8Kb.