Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move base level code to an activate function
Liquidprompt has always had a good chunk of its startup logic at the root level, not in functions. This code is run only once, when it is sourced. Part of the problem with this is that if we want to test Liquidprompt, we need to source it, but we don't want to load all the actual prompt setup stuff, only get the functions. This breaks out the activation stuff into a lp_activate function, so that Liquidprompt can be sourced without running any of that. Now if the '--no-activate' flag is given, it isn't run. The other problem is that a Liquidprompt configuration change requires a full source of Liquidprompt again to update to that configuration. With a correctly built activate function, the config can be reloaded and Liquidprompt reconfigured without needing to source again. To make enabling features work with a re-run of lp_activate(), we need to remove the checks that only define functions if their respective feature is enabled. This does not slow down startup time, but it does slightly pollute the listing of function definitions. Since all of these functions are prefixed with '_lp', users shouldn't see them unless they are looking for them. LP_TIME is broken in this commit: the way it is written now, the "correct" _lp_time() function is set at the root level, after config loading. But now config loading happens last, so no _lp_time() is set (other than the empty one). Anyway, it needs a bunch more work to fix this, and I don't want a huge commit.
- Loading branch information