Skip to content

Consolidate preexec-related functions; Eliminate vendor/init.d #2003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 26, 2022

Conversation

gaelicWizard
Copy link
Contributor

@gaelicWizard gaelicWizard commented Dec 29, 2021

Please see individual commit messages as needed.

Description

The vendor/init.d folder had only one file in it, preexec.bash, and may have been created in a fit of premature optimization. Lose it!

Closes #1844.

Motivation and Context

There's useful functions related to preexec that ought to be in the file, and a few more are needed, and none are usable until after it's loaded.

This PR:

  • Move preexec.bash to lib,
  • Removes the extra loader loop from bash_it.sh,
  • moves existing helper functions from lib/theme to lib/preexec,
  • and adds a couple more useful helper functions.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)

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 changed the title Eliminate vendor/init.d Eliminate vendor/init.d; consolidate preexec functions Dec 29, 2021
@gaelicWizard gaelicWizard marked this pull request as ready for review December 29, 2021 08:18
@gaelicWizard gaelicWizard changed the title Eliminate vendor/init.d; consolidate preexec functions Consolidate preexec-related functions; Eliminate vendor/init.d Dec 29, 2021
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.

Hi @gaelicWizard, see my comments 😄

@gaelicWizard
Copy link
Contributor Author

Rebased on current master and ready to go!

@gaelicWizard
Copy link
Contributor Author

Rebased on current master and ready to go!

@gaelicWizard gaelicWizard force-pushed the preexec branch 3 times, most recently from 9a89ae3 to d68f334 Compare January 25, 2022 05:35
@gaelicWizard
Copy link
Contributor Author

Rebased on current master and ready to go!

gaelicWizard and others added 4 commits January 25, 2022 13:00
Define the helper functions for `bash-preexec.sh` immediately after importing it, rather than in `lib/theme`.
- `__check_precmd_conflict()` and `save_append_prompt_command()` are generally useful and not theme-specific.
- Add matching `__check_preexec_conflict()` and `safe_append_preexec()`.
Alsö, use `_bash-it-array-contains-element()`
@NoahGorny NoahGorny merged commit 3c2bc3d into Bash-it:master Jan 26, 2022
@gaelicWizard gaelicWizard deleted the preexec branch January 26, 2022 15:41
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.

Newest preexec version disables ignorespace and ignoreboth
2 participants