Create lib finalize hook

Create an array `_bash_it_library_finalize_hook` and loop at the end of the main `bash_it.sh` to run each element in the array.

The purpose here is to run some command after everything else has been loaded. For example, the appearance lib checks for executables for SCM commands, but `$PATH` may be altered after appearance has loaded and therefore some available commands may never be discovered. Therefore, create `_bash_it_appearance_scm_init()` and add it to the hook. It will re-check at end of `bash_it.sh` just before prompt is first displayed.
This commit is contained in:
John D Pell
2021-09-11 20:29:49 -07:00
parent 86c1e3c043
commit bdaf29f84c
2 changed files with 11 additions and 3 deletions

View File

@@ -106,7 +106,7 @@ function _bash_it_appearance_scm_init() {
fi
fi
}
_bash_it_appearance_scm_init
_bash_it_library_finalize_hook+=('_bash_it_appearance_scm_init')
function scm {
if [[ "$SCM_CHECK" = false ]]; then