Commit Graph

3517 Commits (68f0cd6ebf0054876378cd98a5c1f656b424e577)

Author SHA1 Message Date
John D Pell 68f0cd6ebf plugins/dirs: use XDG_STATE_HOME
Locate the bookmarks file in $XDG_STATE_HOME, and migrate an existing file from the old location if it exists.
2021-10-18 10:14:28 -04:00
John D Pell 070c35ab0c lib/utilities: XDG_CACHE_HOME
Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.
2021-10-18 10:14:28 -04:00
John D Pell 8317ef2558 lint: add lib to clean_files.txt 2021-10-18 10:13:04 -04:00
John D Pell 0b74fcfadf uninstall: `shellcheck` && `shfmt` 2021-10-18 10:13:04 -04:00
John D Pell 6684422ff7 lib/preview: `shfmt` && `shellcheck`
Fix theme file path globbing when $BASH_IT contains any spaces.

My apologies to future `git blame` hunters ♥
2021-10-18 10:13:04 -04:00
John D Pell 1506f9a6c9 reloader: `shellcheck` && `shfmt`
Rewrite globbing per `shellcheck`'s SC2013 recommendations, and standardize whitespace.
2021-10-18 10:13:04 -04:00
John D Pell 5d130a4f1e lib/reloader: adopt `_bash-it-log-prefix-by-path()` 2021-10-18 10:13:04 -04:00
John D Pell e3f7f09608 lib: delete `appearance.bash`
This adds *three* lines to `bash_it.sh`, and two to `plugin/base`. Just not worth an extra file requiring special handling.
2021-10-18 10:13:04 -04:00
John D Pell 08217d74bc lib/appearance: `shellcheck` && `shfmt` 2021-10-18 10:12:44 -04:00
John D Pell 437fd2a928 main: simplify flow of lib loader loop
Eliminate the separate loop for `vendor/init.d` since it's just as easy to glob it in the `lib` loop.
2021-10-18 10:12:44 -04:00
John D Pell a71c98e84b main: adopt `_bash-it-log-prefix-by-path()` 2021-10-18 10:12:44 -04:00
John D Pell 077b2c5f6d 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
2021-10-18 10:12:43 -04:00
John D Pell 2f52b43e6f lib/log: function `_bash-it-log-prefix-by-path()`
...to replace `_set-prefix-based-on-path()` in `scripts/reloader`.
2021-10-18 09:59:46 -04:00
John D Pell 7184c49b1c lib/log: rename `_log_general()`
...to `_bash-it-log-message()`.

alsö, add common log levels with common names.
2021-10-16 14:40:54 -07:00
John D Pell 2973434af5 lib/log: `shellcheck` && `shfmt`
Alsö, fix tests to load `lib/colors` instead of `lib/appearance`...wut

Alsö, `short-circuit _has_colors()`: If we already looked up colors, and we already have them, then don't run `tput` again.

My apologies to future `git blame` hunters ♥
2021-10-16 14:38:31 -07:00
John D Pell 512ca416ed lib/search: `shfmt`
My apologies to future `git blame` hunters ♥
2021-10-16 14:37:27 -07:00
John D Pell b06cd70fc0 lib/search: fix usage statement `_bash-it-search()`
SC2154
2021-10-16 14:37:27 -07:00
John D Pell 12385d05a5 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.
2021-10-16 14:37:27 -07:00
John D Pell f7157b153d lib/search: `shellcheck`
SC2076
SC2091
SC2004
SC2086
SC2207
2021-10-16 14:37:27 -07:00
John D Pell 9e2cc9d779 lib/search: code style cleanup
Couldn't even `shellcheck` until I did a first pass...too much noise! ♥
2021-10-16 14:35:28 -07:00
John D Pell 31bd63f5ed plugins/ruby: tests on Mac OS X
Test was failing only on Mac OS X for some reason, so refactor a little.
2021-10-16 14:34:54 -07:00
John D Pell 778db5aaad lib/helpers: fix `_bash-it-describe()` 2021-10-16 14:34:54 -07:00
John D Pell 9c0415c41e lib/helpers: cleanup
- Improve `pushd`/`popd` somewhat
- local some parameters
- Lose weird Mac-specific alternate shell startup file (Bash loads startup files on Mac the same as it does on any other *nix system.)
2021-10-16 14:34:54 -07:00
John D Pell 7ea6efab3f lib/helpers: fix `all_groups()`
- Don't write to disk, just pipe.
- Don't loop, just do all functions.

Performance of old implementation on my system:
```
real    0m9.996s
user    0m5.318s
sys     0m9.126s
```

Performance of new implementation on my system:
```
real    0m0.052s
user    0m0.069s
sys     0m0.025s
```
2021-10-16 14:32:44 -07:00
John D Pell 5043c78701 lib/helpers: `shfmt`
My apologies to future `git blame` hunters ♥
2021-10-16 14:32:44 -07:00
John D Pell a0a359f22c lib/helpers: second `shellcheck` pass
lib/helpers: lint `_bash-it-migrate()`

lib/helpers: lint `_disable-thing()`

lib/helpers: lint `_enable-thing()`

lib/helpers: lint `_help-list-aliases()`

lib/helpers: lint `_help-plugins()`

lib/helpers: some SC2034 fixes

And SC2154 in `_make_reload_alias()`

lib/helpers: lint `all_groups()`
2021-10-16 14:32:44 -07:00
John D Pell 9c77c0f61c lib/helpers: fix `_command_exists()`
The weird subshell is weird AF. Just do a normal `if`.

Ditto `_binary_exists()`, `_completion_exists()`, and `_is_function()`!
2021-10-13 21:59:20 -07:00
John D Pell 1dfa28af25 lib/helpers: first `shellcheck` pass
Quote things, SC2268, SC2143, SC2181, SC2162, SC2016, SC2013, &c.

Rewrite globbing per `shellcheck`’s SC2013, and alsö s/typeset/local/g. Eliminate `compgen` where possible.

Alsö: use the existing utility functions `_bash-it-get-component-type-from-path` and `_bash-it-get-component-name-from-path`, which just use parameter substitution anyway. Why was `sed` here?

Alsö, don't add not-existing directories to `$PATH` in `pathmunge()`
2021-10-13 21:59:20 -07:00
Noah Gorny cf08fcaff2
Merge pull request #1965 from gaelicWizard/completion-git
completion/git: improvements and linting
2021-10-07 00:10:47 +03:00
Noah Gorny c3382c7b50
Merge pull request #1884 from NoahGorny/add-blesh-plugin
plugins: Add ble.sh plugin
2021-10-06 22:49:15 +03:00
cornfeedhobo 07384bcf7c
Merge pull request #1967 from cornfeedhobo/goenv-go-tests
skip go tests when go is not available
2021-09-30 07:34:05 -05:00
cornfeedhobo b7feb14404
skip go tests when go is not available 2021-09-29 18:16:52 -05:00
Noah Gorny 7fb7bb9cb8
Merge pull request #1952 from gaelicWizard/uncle
lib/helpers: new function `_bash-it-find-in-ancestor()`
2021-09-28 16:51:30 +03:00
Noah Gorny 008c2b30ac
Merge pull request #1885 from cornfeedhobo/pyenv-path
clean up pyenv plugin
2021-09-28 16:49:21 +03:00
Noah Gorny c360f0c7c5 plugins: Add ble.sh plugin 2021-09-28 16:48:16 +03:00
cornfeedhobo ec075a404a
clean up pyenv plugin
This commit cleans up the pyenv plugin to follow the newer conventions of the
other *env plugins, as well as addresses the changes made to pyenv for PATH
munging.
2021-09-28 07:44:40 -05:00
John D Pell 3eed0f033f
Lint: prepare `lib/utilities` for `shellcheck` (#1933)
* lib/utilities: shellcheck

SC2059

* lib/utilities: fix `_bash-it-get-component-type-from-path()`

Account for plugins with names that contain periods.

* lib/utilities: fix `_bash-it-array-dedup()`

Use fewer subprocesses and newline-delimited not space-delimited.

* lib/utilities: fix `_bash-it-component-list()`

Use fewer subprocesses and return newline-delimited, not space-delimited.

* lib/utilities: fix `_bash-it-component-list-matching()`

Use `sort -u` instead of `sort | uniq`

* lib/utilities: fix `_bash-it-component-list-enabled()`

Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort`

* lib/utilities: fix `_bash-it-component-list-disabled()`

Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort`

* lib/utilities: fix `_bash-it-grep()`

1. Executing `'/usr/bin/grep'` does *not* return the path to grep...
2. use `type -p` instead of external binary `which`.
3. Simplify parameter definition.
4. Why was there a space after `%s`?

* lib/utilities: use `_bash-it-grep`

Alsö, lose a spurious `cat`

* lib/utilities: lint `_bash-it-component-help`

* lib/utilities: lint `_bash-it-component-cache-file()`

* lib/utilities: `shfmt`

My apologies to future `git blame` hunters ♥

* lib/helpers: fix `_bash-it-get-component-name-from-path()`

Use `${BASH_IT_LOAD_PRIORITY_SEPARATOR}`
2021-09-28 15:24:18 +03:00
Noah Gorny 8a1dc96bc0
Merge pull request #1964 from gaelicWizard/completion-pip
completion/pip: simplify control flow
2021-09-28 15:14:58 +03:00
John D Pell c2c76a380a
plugin/base: improvements (#1930)
* plugins/base: code style improvements

Quote variables, use $@ and $array[@] instead of $*, typeset some integers, remove unneccesasary binary invocation, use shell features when possible, remove `eval`, &c.

* plugins/base: conditional function definitions

Instead of functions failing when required tools aren't installed, just don't define the function.
Alsö, don't redefine del() if it already exists.

* plugins/base: rewrite `usage()`

Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary.

* plugins/base: revamp `quiet()`

New implementation that is even quieter.

* plugins/base: `myip()`

* plugins/base: `pickfrom()`

* plugins/base: `passgen()`

Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`.

* plugins/base: `mkcd()`

* plugins/base: `mkiso()`

* plugins/base: remove `banish-cookies()`

Adobe Flash is gone with the wind. Alsö, this would be something someone would do *once* and shouldn't be a function...

* plugins/base: `lsgrep` is SC2010

The `lsgrep()` function is *itself* explicitly forbidden by `shellcheck` rule SC2010.

Alsö, s/`$*`/`$@`

* plugins/base: `mkiso()`

Expressly handle unbound parameters.

* plugins/base: remove `command_exists`

* plugin/base: lint SC2154 && SC2144

Newly undisabled `shellcheck` rules

* plugin/base: import libs for tests

* plugin/base: `shfmt`

Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
2021-09-28 15:13:27 +03:00
Noah Gorny 127cbbd4e3
Merge pull request #1957 from gaelicWizard/plugin-less-pretty-cat
plugin/less-pretty-cat improvements
2021-09-28 15:09:28 +03:00
Noah Gorny 05aac8ef39
Merge pull request #1956 from gaelicWizard/plugin-percol
plugin/percol `shellcheck`
2021-09-28 15:06:33 +03:00
Noah Gorny 002a23c758
Merge pull request #1961 from gaelicWizard/completion-wpscan
completion/wpscan: simplify code flow (whitespace)
2021-09-28 15:02:25 +03:00
Noah Gorny 37577550e1
Merge pull request #1963 from gaelicWizard/completion-laravel
completion/laravel: simplify code flow
2021-09-28 14:34:51 +03:00
Noah Gorny 198df8044a
Merge pull request #1955 from gaelicWizard/plugin-ruby
plugin/ruby `shellcheck`
2021-09-28 14:16:19 +03:00
John D Pell a4e4f30ff1 plugins/percol: `bind`
Move `bind` below function definition
2021-09-26 11:54:32 -07:00
John D Pell b0750fa49f completion/git: `shfmt` && `shellcheck` 2021-09-24 21:11:28 -07:00
John D Pell e22aac855e completion/git: expand search range
- Remove limitation on OS.
- Add search for Mac OS X developer tools locations by using `xcrun` instead of trying to guess paths.
- Add search for locations based on path of `$GIT_EXE` (set by `lib/theme`).
2021-09-24 21:10:01 -07:00
John D Pell 92282c4795 plugin/percol: `shellcheck` & `shfmt`
According to `shellcheck`, the `_tac` alias simply doesn't work. At all. Ever. See SC2262 and SC2263.
2021-09-24 00:39:07 -07:00
John D Pell 2ada414266 plugins/percol: use `_command_exists`
Addresses bash-it/bash-it#1632

And use `_log_warning`.

Alsö, code style cleanup: quote things, handle unbound parameters, &c.

Alsö alsö, short-circuit if not installed or inadequate _Bash_ version.
2021-09-24 00:38:54 -07:00
John D Pell b897c7d3ce completion/pip: simplify code flow
Short-circuit the loader rather than indenting nearly the whole file.

ALSÖ, assign the `_pip_completion()` handler directly once it's loaded so that we get out of the way once we load it.
2021-09-23 22:21:02 -07:00