Commit Graph

303 Commits

Author SHA1 Message Date
BarbUk
e1ddf6e311 Fix dynamic clock icon (#2120)
* Fix dynamic clock icon

* Use printf variable scope

* shfmt do not like spaces
2022-03-09 22:59:48 +02:00
Noah Gorny
13531c9534 lib: search: Increase delay in _bash-it-flash-term to 0.2 secs 2022-03-08 00:02:23 +02:00
Noah Gorny
77c135956d lib: preview: Load only bash-it.sh when previewing
Otherwise you change your theme to your default...
2022-03-08 00:01:37 +02:00
John D Pell
1c2fc2837f lib/command_duration: adopt _bash_it_library_finalize_hook 2022-03-04 12:58:07 -08:00
John D Pell
4e0e59230b lib/command_duration: rename theme/command_duration.theme
Rename the `theme/command_duration.theme` file as it's not really got anything to do with theming or SCM.
2022-03-04 12:58:07 -08:00
John D Pell
0286a50fcd lib/appearance: export $CLICOLOR instead of $LSCOLOR
Alsö, since the *value* of `$CLICOLOR` is not used anywhere, overload it to count the number of colors available for use elsewhere.
2022-03-03 23:58:55 -08:00
John D Pell
f7cba27f10 lib/appearance: shellcheck && shfmt 2022-03-03 23:58:55 -08:00
Noah Gorny
34bc37c178 Merge pull request #2061 from gaelicWizard/lib/helpers
lib/helpers: fixes, improvements, consolations, constellations, and a partridge in a pear tree
2022-03-01 23:21:27 +02:00
John D Pell
47bbc73744 lib/helpers: _bash-it-find-in-ancestor()
Use new `composure.sh` feature to avoid `cite()`.
2022-02-24 12:47:22 -08:00
John D Pell
5957d189ea lib/utilities: _bash-it-component-item-is-enabled()
- Use normal `if`/`then`
2022-02-20 12:01:05 -08:00
John D Pell
fe48deda2d lib: rename _bash-it-clean-component-cache()
…to `_bash-it-component-cache-clean()`
2022-02-20 12:01:05 -08:00
John D Pell
6257853759 lib/utilities: use $XDG_CACHE_HOME properly
We should fall back to the default location, not use an entirely different one.
2022-02-20 12:01:05 -08:00
John D Pell
72829ca21d lib/utilities: _bash-it-component-item-is-enabled()
- required arguments
2022-02-20 12:01:05 -08:00
John D Pell
ffcf8f1c94 lib/utilities: >| 2022-02-20 12:01:05 -08:00
John D Pell
fbd842b2ea lib/helpers: fix extraneous quotes from _bash-it-grep() 2022-02-20 12:01:05 -08:00
John D Pell
150f73ee50 bash-it update: show change log once 2022-02-18 03:06:17 -08:00
John D Pell
95353f1a98 lib/helpers: the last remnants of the $OSTYPE have been swept away
- Figure out which `sed` we have by checking, not guessing.
2022-02-17 20:46:28 -08:00
John D Pell
ddf75f17ac lib/search: fix variable scope 2022-02-17 20:46:28 -08:00
John D Pell
35ecc260c2 lib/helpers: handle unbound parameters 2022-02-17 20:46:28 -08:00
John D Pell
31751624c0 lib/helpers: cleanup _bash-it-profile-load-parse-profile() a bit 2022-02-17 20:45:37 -08:00
John D Pell
e7818dbaca lib/helpers: handle unbound positional parameters
Alsö, don't `pushd`/`popd` when restarting shell.
2022-02-17 20:45:37 -08:00
John D Pell
60c10004d1 lib/helpers: fix _bash-it-component-pluralize() 2022-02-17 20:45:27 -08:00
John D Pell
8246794a28 lib/preexec: the last remnants of the $OSTYPE have been swept away
- Use a POSIX-compliant/portable extended regular expression to match on word-boundaries, rather than guessing which regex library `bash` was linked against. See https://stackoverflow.com/a/12696899/555333 for explanation and code suggestion.
2022-02-16 16:10:41 -08:00
John D Pell
c1943192ce lib/preexec: clarify subshell guard and comment
Rewrite comment on disabling the `DEBUG` trap in subshells, which is now handled upstream as of rcaloras/bash-preexec#26.

Alsö, fix the guard variable assignment to allow it to be overridden elsewhere (e.g., for testing).
2022-02-16 16:10:41 -08:00
John D Pell
a93919625d lib/preexec: adobt _bash_it_library_finalize_hook
Schedule modification of `$PROMPT_COMMAND` for after everything has loaded.
2022-02-16 16:10:41 -08:00
John D Pell
6b08284928 Update "preexec" from "https://github.com/rcaloras/bash-preexec@master"
git-vendor-name: preexec
git-vendor-dir: vendor/github.com/rcaloras/bash-preexec
git-vendor-repository: https://github.com/rcaloras/bash-preexec
git-vendor-ref: fd2ffa8876d3940c97ffdc3cc807e43277cf72da
2022-02-16 16:10:41 -08:00
Noah Gorny
9d6fe72267 Merge pull request #2088 from gaelicWizard/lib/log
lib/log: //echo/printf
2022-02-16 22:18:22 +02:00
Puneeth Chaganti
b3ef9ea209 lib/helpers: Don't rm "$profile_path" before writing to it
When the file is being re-created, we write to it, instead of appending to
it. So, the rm here is unnecessary and prevents users from linking the profile
file to another location that is potentially under version control. For
instance, once could link to a profile file located at
"$BASH_IT_CUSTOM/profiles/*.bash_it".
2022-02-16 20:55:08 +05:30
John D Pell
e7b91e7be5 lib/log: use newly supported composure.sh feature
- these functions can now run even if `composure.sh` has *not* been loaded at all!
2022-02-15 22:20:19 -08:00
John D Pell
61b6393a4a lib/log: //echo/printf
- Replace `echo -e` with `printf` in `_bash-it-log-message()`.
- Local positional parameters to allow for defaults.
- Use `if`/`then` properly.
- Clean up use of `$BASH_IT_LOG_PREFIX` slightly (eliminate duplicate colons).
2022-02-15 22:18:24 -08:00
Noah Gorny
89c9504a5e Merge pull request #2017 from gaelicWizard/lib/preview
lib/preview: functionalize
2022-02-13 23:59:06 +02: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
00e3955dd3 lib/preview: add full completion 2022-02-07 15:27:03 -08:00
John D Pell
a9a40a3cad lib/helpers: add preview to bash-it spaghetti 2022-02-07 15:27:03 -08:00
John D Pell
d6555f369a lib/preview: refactor into a function
This allows future use like `bash-it preview`. Alsö, allows to use `$BASH_PREVIEW` to specify a particular theme to preview instead of just doing all of them.
2022-02-07 15:27:03 -08:00
Nariyasu Heseri
1e77c26c00 helpers: fix awk: unterminated regexp 2022-01-31 23:54:14 +09: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
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
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
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
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
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