Commit Graph

772 Commits (2e52d2a77cb83e10970d52cf2002c2907e414b7e)

Author SHA1 Message Date
gmajkic 7c77223b15 fix(theme): use correct escape sequence to avoid weird text overwriting 2022-10-14 09:43:51 +02:00
David Farrell 00062bfcb6
chore: Use grep -E / grep -F instead of egrep / fgrep (#2164)
Ensures that the -E or -F option, when used, is the first option
* i.e. grep -oE => grep -E -o

Updates _bash-it-grep to invoke grep with just the provided arguments
* This function was (and still is) unused, but decided this new functionality was actually more useful

Introduces _bash-it-fgrep to invoke grep -F

Removes type -P egrep from the _bash-it-*grep functions

For usages that were already going to be modified, use -F if appropriate
* Does not touch grep usages that may have benefited from -F, but were not otherwise considered for this PR

Adds shellcheck header to modified .bash files that didn't already have it
2022-10-13 10:34:57 -07:00
BarbUk 9a71556b99
shfmt needs more spaces 2022-03-09 22:04:18 +01:00
BarbUk b839294827
Complete rework 2022-03-09 21:29:51 +01:00
Ira Abramov ec6d371db8
Add a 'theme' for OMP, so the internal themes don't clash with it. (#2100)
* Add a 'theme' for OMP, so the internal themes don't clash with it.

* Add theme to clean_files

* Add screenshot to the docs

* Correct the name of the default theme in the docs.

* keeping it cleaner

Co-authored-by: Ira Abramov <github@ira.abramov.org>
2022-03-07 00:23:49 +02: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 33505d4db1 lib/command_duration: Refactor using `$EPOCHREALTIME`
Fallback to `$SECONDS` for older versions of _Bash_.

Instead of shortcircuiting the definition, just short-circuit the function. This allows the variable to be set later, e.g. on theme change.
2022-03-04 12:58:07 -08:00
John D Pell 09e8c25b64 lib/command_duration: dynamic clock hand
Calculate the position (from 1 to 12) of the hour hand on the clock emoji used for the _command_duration string.

Expressly handle COMMAND_DURATION_COLOR as blank when undefined.
2022-03-04 12:39:58 -08:00
John D Pell ad1d73aaa1 lib/command_duration: remove temporary files 2022-03-04 12:39:02 -08:00
John D Pell df87b41635 lib/theme: use `_command_exists()` in `rbenv_version_prompt()` 2022-03-03 22:54:09 -08:00
John D Pell 7762aa687a lib/theme: `local hg_root` in `hg_prompt_vars()` 2022-03-03 22:54:09 -08:00
John D Pell c9efc161ff lib/theme: improve performance of `scm()`
- Don't invoke the source control utility when all we want to know is if we're somewhere inside the repository; use `_bash-it-find-in-ancestor()`.
2022-03-03 22:54:09 -08:00
John D Pell d86a182b6e lib/theme: export `$LS_COLORS` et al 2022-03-03 22:54:09 -08:00
John D Pell c6ac9109d7 lib/theme: parameter cleanup
Improve handling of parameters by adding defaults (often blank).

Alsö, eliminate newlines from `echo` in many places.
2022-03-03 22:54:09 -08:00
John D Pell 2b3af0d8c9 lib/theme: eliminate a lot of subshells
A lot of useless `echo`s in here.
2022-03-03 22:54:09 -08:00
John D Pell ac0d91b682 lib/theme.githelpers: remove dead code
Five years deprecation is plenty warning.
2022-03-03 22:54:09 -08:00
John D Pell 1d73537dbf lib/theme: `shfmt` && `shellcheck`
My apologies to future `git blame` hunters ♥

Use the "short" host name by default (`\h`), not the fully qualified domain name (`\H`)...

lib/theme: don't redefine battery_char()

Combine the two definitions for `battery_char()` so the second one doesn't just overwrite the first one. Do one or the other, not both.

Don't evaluate if `battery_percentage()` is available at load time, evaluate it at run time.

Don't run `date` for `$THEME_TIME_FORMAT`, use `\D{fmt}`.
2022-03-03 22:54:09 -08:00
John D Pell 6bacd5fb1c lib/githelpers: `shfmt` && `shellcheck`
My apologies to future `git blame` hunters ♥
2022-03-03 22:54:08 -08:00
John D Pell fbc5d0a5af lib/p4helpers: `shfmt`
My apologies to future `git blame` hunters ♥
2022-03-03 22:53:13 -08:00
John D Pell 0e0e0d3035 lib/theme: Fix a *few* SC2154
These variables are referenced by themes already linted.
2022-03-03 22:53:13 -08:00
John D Pell 2cea663a4a lib/theme: handle undefined parameter 2022-02-18 03:06:17 -08:00
John D Pell 363827a3b5 theme/pure: cleanup
Use `\$` to let _Bash_ choose the mark, move `PS1=` outside the `case` statement.

#TODO: last command status?
2022-02-13 16:18:00 -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 5f19de8d51 plugin/colors: rename `theme/colors` 2022-01-28 13:09:00 -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
Noah Gorny 44a1b55db7
Merge pull request #2037 from gaelicWizard/theme/brunton
theme/brunton: `shellcheck`
2022-01-25 18:18:54 +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
John D Pell b1e922ea38 theme/norbu: `shellcheck` && `shfmt`
# Conflicts:
#	clean_files.txt
2022-01-25 00:01:27 -08:00
Noah Gorny dbb3ea4736
Merge pull request #2035 from gaelicWizard/theme/pete
theme/pete: `shellcheck` && `shfmt`
2022-01-24 23:32:58 +02:00
John D Pell 21942f6275 lib/theme: disable THEME_CHECK_SUDO
Move `$THEME_CHECK_SUDO` to `lib/them`, and set it to `false` instead of `true`.
2022-01-24 11:46:16 -08:00
John D Pell 27ebc585be theme/brunton: SC2154
Handle all unbound parameters, even colors!
2022-01-12 13:38:10 -08:00
John D Pell 8e8fe69db4 theme/pete: `shellcheck` && `shfmt` 2022-01-12 13:29:40 -08:00
John D Pell bdaf29f84c 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.
2022-01-09 00:46:51 -08:00
John D Pell fcbe4e90b7 theme/easy: SC2154
Handle all unbound parameters, even colors!
2022-01-08 08:45:52 -08:00
John D Pell c7c447a54b theme/candy: SC2154
Handle all unbound parameters, even colors!
2022-01-08 08:45:52 -08:00
John D Pell 262e55eda2 theme/bobby: SC2154
Handle all unbound parameters, even colors!
2022-01-08 08:45:52 -08:00
John D Pell 6db5f38f6e theme/atomic: lint/cleanup
Use `[[` instead of `[`, set some local variables, still more to clean
2022-01-08 08:45:35 -08:00
Noah Gorny 6fc47a7671
Merge pull request #2021 from NariyasuHeseri/master
theme/powerline: fix error `scm: parameter not defined`
2022-01-07 08:51:00 +02:00
Nariyasu Heseri 9d8002226d theme/powerline: fix error `scm: parameter not defined` 2022-01-06 18:44:18 +09:00
John D Pell f2dcb2aff6 theme/essential: s/echo/printf/g 2022-01-03 20:45:39 -08:00
John D Pell 3695862b43 theme/essential: cleanup
Lose a couple of useless `echo`s/subshells.

Alsö, lose the incorrect VIM modeline from the bottom. Our formatting standard is specified in `$BASH_IT/.EditorConfig`.
2022-01-03 20:45:39 -08:00
John D Pell d1b7166358 theme/essential: `shfmt` 2022-01-03 20:45:39 -08:00
John D Pell 9f79848eed theme/essential: SC2154
Handle all unbound parameters, even colors!
2022-01-03 20:45:39 -08:00
John D Pell 2991aa66ca theme/powerline: SC2154, SC2248 2021-12-27 12:20:46 -08:00
John D Pell c323357067 theme/purity: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell e560e88814 theme/pure: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell 895102edeb theme/codeword: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell 4bc83d7940 theme/bira: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell 2c14a18483 theme/bakke: fix SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell c769234350 theme/90210: fix SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00