Commit Graph

3761 Commits

Author SHA1 Message Date
Noah Gorny
253004a599 Merge pull request #1940 from gaelicWizard/history
Feature: automatic history management
2022-02-13 23:57:14 +02:00
Noah Gorny
23f9b7416a Merge pull request #1902 from gaelicWizard/glob
Glob for *.bash properly when path contains spaces
2022-02-13 23:53:57 +02:00
John D Pell
146107926e main: variable name cleanup 2022-02-10 10:46:33 -08:00
John D Pell
5d5858058e lib/history: new functions _bash-it-history-auto-*()
Two new functions `_bash-it-history-auto-save()` and `_bash-it-history-auto-load()`, which append new history to disk and load new history from disk, respectively.

See bash-it/bash-it#1595 for discussion.
2022-02-08 16:59:29 -08:00
John D Pell
f6119567e8 plugin/history*search: no need to load after plugin/history
There's no need for these plugins to load after `plugin/history`. None of the history plugins depend upon each other loading before, after, or at all.
2022-02-08 16:59:29 -08:00
John D Pell
267a721ac6 plugin/history-eternal: Use readonly instead of export
...and hide errors relating to setting already-readonly variables.

`plugin/history-eternal` does not need to force loading after `plugin/history` because both plugins will play nicely with read-only variables, and since we're overwritting and marking read-only then the intended result survives no matter which loads first.

plugin/history-eternal: require Bash v4.3+

Unlimited history is only possible in _Bash_ version 4.3 and up
2022-02-08 16:59:29 -08:00
John D Pell
8052911861 plugin/history: don't use export
...so the plugin is friendly to variables already marked read-only.
2022-02-08 16:59:29 -08:00
John D Pell
bc95eceb10 main: adopt _bash-it-log-prefix-by-path() 2022-02-06 16:59:03 -08:00
John D Pell
0d346b204f main: Glob for *.bash properly when path contains spaces
- `shfmt`, `shellcheck`
- Clean up legacy/compatibility code to simpler control flow
- Move theme stuff down to where themes are handled
- Don't use `**` as _Bash It_ has never before set `globstar`; this eliminates varying behavior by environment; this alsö fixes users having any not-enabled themes under their custom dir.
- Lose weird Mac-specific alternate shell startup file (Bash loads startup files on Mac the same as it does on any other *nix system.)
- Place `composure.sh` init all in one place
- remove 10-years-deprecated backwards compatibility: Deprecated in `b59ee658f78ec6ff8c6c2754216e0322b7fe18e2` dated 2011-10-29.
2022-02-06 16:59:03 -08:00
Noah Gorny
4dbe92e38d Merge pull request #2075 from NariyasuHeseri/awk_unterminated_regexp
helpers: fix `awk: unterminated regexp`
2022-02-04 11:52:21 +02:00
Nariyasu Heseri
1e77c26c00 helpers: fix awk: unterminated regexp 2022-01-31 23:54:14 +09:00
Noah Gorny
578c702ca3 Merge pull request #2055 from gaelicWizard/lib/reloader
lib/reloader: lint and modernize
2022-01-30 00:10:32 +02:00
Noah Gorny
2a9ee7e344 Merge pull request #2019 from gaelicWizard/lib/colors
lib/colors: split out metaprogramming
2022-01-30 00:10:14 +02:00
Noah Gorny
39e5652ee5 Merge pull request #1932 from gaelicWizard/search
Lib/search: lint, cleanup, and small fixes
2022-01-30 00:09:49 +02:00
Noah Gorny
1d6f4d747b Merge pull request #2067 from gaelicWizard/BASH_IT_BASHRC
lib/helpers: eliminate assumptions about login shells
2022-01-29 22:42:21 +02:00
John D Pell
26b402e254 lib/reloader: unset "${!_bash_it_reloader_@}" 2022-01-28 13:58:00 -08:00
John D Pell
4cf2aae36e lib/search: code cleanup
Improve `_bash-it-erase-term()`, `_bash-it-flash-term()`, `_bash-it-rewind()`, `_bash-it-search-result()`, and `_bash-it-search-component()`. Minor tweaks to `_bash-it-is-partial-match()`, and `_bash-it-search()`.
2022-01-28 13:35:17 -08:00
John D Pell
b8694ee140 lib/search: shfmt
My apologies to future `git blame` hunters ♥
2022-01-28 13:35:17 -08:00
John D Pell
8939e943c5 lib/search: fix usage statement _bash-it-search()
SC2154
2022-01-28 13:35:17 -08:00
John D Pell
64efe52394 lib/search: fix _bash-it-flash-term()
1. `$text_black` isn't a parameter provided by _Bash It_. Typo?
2. `$bold_yellow` is meant for prompt strings and putputs `\[`; ditto `$bold_red`.
3. The color was never returned to normal after.
2022-01-28 13:35:17 -08:00
John D Pell
afeb4d6e11 lib/search: shellcheck
SC2076
SC2091
SC2004
SC2086
SC2207
2022-01-28 13:35:17 -08:00
John D Pell
5478617a89 lib/search: code style cleanup
Couldn't even `shellcheck` until I did a first pass...too much noise! ♥
2022-01-28 13:35:17 -08:00
John D Pell
85a77f1e46 lib/colors: Separate metaprogramming 2022-01-28 13:09:53 -08:00
John D Pell
bf4ddf5951 plugin/colors: shfmt 2022-01-28 13:09:00 -08:00
John D Pell
399f0265aa plugin/colors: revert #699
This reverts commit 2a3fde2b14 but does *not* restore the previous variables. Those are still provided by `lib/colors`.

This plugin exists for anyone who likes the metaprogramming adventure of computing colors dynamically rather than using hard-coded value. Potentially this could be used by themes, or possibly by a theme color-scheme randomizer?
2022-01-28 13:09:00 -08:00
John D Pell
5f19de8d51 plugin/colors: rename theme/colors 2022-01-28 13:09:00 -08:00
John D Pell
16cee1956d lib/colors: revert #99
This reverts bash-it/bash-it#99, a metaprogramming adventure in terminal color code escape computation. It was functionally reverted in bash-it/bash-it#699; I'm just finishing the job.
2022-01-28 13:08:50 -08:00
John D Pell
2a8d8ba540 lib/colors: rename theme/colors 2022-01-28 13:08:50 -08:00
John D Pell
fd7b20b8d7 reloader: shellcheck && shfmt
Rewrite globbing per `shellcheck`'s SC2013 recommendations, and standardize whitespace.
2022-01-28 03:59:45 -08:00
John D Pell
75d22d865f lib/reloader: adopt _bash-it-log-prefix-by-path() 2022-01-28 03:59:45 -08:00
John D Pell
c08267e25d lib/helpers: eliminate assumptions about login shells
Bash loads initialization files on Mac just the same as it does on Linux or WSL. Our previous assumptions were wrong, and my fix was alsö wrong because I made more assumptions!

This patch eliminates the assumptions. Literally just load either the startup file the shell started with, or fall back to `~/.bashrc`. Don't check `shopt -q login_shell` and don't check `$OSTYPE` or anything else.
2022-01-28 03:59:02 -08:00
Noah Gorny
7e79212dff Merge pull request #2072 from gaelicWizard/lib/preexec
lib/preexec: tests!
2022-01-27 23:55:21 +02:00
John D Pell
2343e2dd35 lib/preexec: tests! 2022-01-27 12:40:38 -08:00
John D Pell
d1d7cd4383 tests: add *.bats to .editorconfig 2022-01-27 11:30:35 -08:00
Noah Gorny
056c392a54 lib: preexec: Properly return if there was a conflict in check_*_conflict
It goes the other way around!
2022-01-26 18:25:37 +02:00
Noah Gorny
0c24edae06 Merge pull request #2064 from gaelicWizard/plugin/battery
plugin/battery: `shellcheck`
2022-01-26 17:47:59 +02:00
Noah Gorny
3c2bc3d196 Merge pull request #2003 from gaelicWizard/preexec
Consolidate `preexec`-related functions; Eliminate `vendor/init.d`
2022-01-26 17:34:46 +02:00
Noah Gorny
5a849419ba Merge pull request #2040 from gaelicWizard/parallel
CI: install `parallel` on OSX
2022-01-26 17:29:26 +02:00
John D Pell
3cb5f3f7e6 plugin/battery: shellcheck 2022-01-25 23:54:24 -08:00
John D Pell
eeaf59b439 CI: install parallel on OSX
This should (hopefully) speed up tests!
2022-01-25 13:38:41 -08:00
John D Pell
ae8c9c08a3 lib/preexec: trim whitespace
Alsö, use `_bash-it-array-contains-element()`
2022-01-25 13:00:04 -08:00
John D Pell
7770e8cbb9 lib/preexec: log an error if bash-preexec not loaded 2022-01-25 13:00:04 -08:00
John D Pell
9f146f937a lib/preexec: consolidate helper functions
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()`.
2022-01-25 13:00:04 -08:00
John D Pell
7a0b353cea lib/preexec: rename vendor/init.d/preexec.bash 2022-01-25 13:00:04 -08:00
Noah Gorny
2575d64deb Merge pull request #2010 from gaelicWizard/plugin-projects
Plugin/projects: cleanup
2022-01-25 18:28:53 +02:00
Noah Gorny
44a1b55db7 Merge pull request #2037 from gaelicWizard/theme/brunton
theme/brunton: `shellcheck`
2022-01-25 18:18:54 +02:00
Noah Gorny
878bbe5942 Merge pull request #2042 from gaelicWizard/completion/dotnet
completion/dotnet: new completion
2022-01-25 18:16:06 +02:00
Noah Gorny
dd83efc35f Merge pull request #2041 from gaelicWizard/theme/sudo
lib/theme: disable THEME_CHECK_SUDO
2022-01-25 18:12:47 +02:00
Noah Gorny
035eabade6 Merge pull request #2036 from gaelicWizard/theme/norbu
theme/norbu: `shellcheck` && `shfmt`
2022-01-25 18:10:21 +02:00
Noah Gorny
80c52b4c25 Merge pull request #2049 from gaelicWizard/CI
CI: fix version of OSX runner
2022-01-25 18:07:46 +02:00