Skip to content

Conversation

@gaelicWizard
Copy link
Contributor

@gaelicWizard gaelicWizard commented Dec 29, 2021

Description

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.

Motivation and Context

The purpose here is to run some command after everything else has been loaded. For example, lib/theme checks for executables for SCM commands, but $PATH may be altered after lib/theme has loaded and therefore some available commands may never be discovered. To accommodate this problem, 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.

How Has This Been Tested?

This has been part of my main branch for months and all tests pass.

Types of changes

  • Enhancement (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • If my change requires a change to the documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • I have added tests to cover my changes, and all the new and existing tests pass.

@gaelicWizard gaelicWizard requested a review from NoahGorny January 4, 2022 01:44
@gaelicWizard gaelicWizard force-pushed the finalize branch 3 times, most recently from cfec924 to 3c057c5 Compare January 8, 2022 16:26
Copy link
Member

@NoahGorny NoahGorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.
@NoahGorny NoahGorny merged commit fd35094 into Bash-it:master Jan 18, 2022
@gaelicWizard gaelicWizard deleted the finalize branch January 18, 2022 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants