John D Pell
251e23a3fa
lib/helpers: use `awk` to count lines instead of piping to `wc -l`
...
Co-authored-by: Kostas Giapis <45879751+tsiflimagas@users.noreply.github.com>
2022-01-18 11:02:37 -08:00
John D Pell
317ff77810
lib/helpers: be extra careful with word splitting
...
Use curly braces when `$1` is unseparated from words in a string.
2022-01-18 11:02:37 -08:00
John D Pell
550f808884
lib/helpers: fix `_bash-it-describe()`
...
Use `_bash-it-component-item-is-enabled()`
Fix SC2295
2022-01-18 11:02:37 -08:00
John D Pell
4c473853e9
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.)
2022-01-18 11:02:37 -08:00
John D Pell
003b0ce802
lib/helpers: `shfmt`
...
My apologies to future `git blame` hunters ♥
2022-01-18 11:02:36 -08:00
John D Pell
6ed006a167
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()`
2022-01-18 11:02:21 -08:00
John D Pell
5eab3bd288
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()`.
Finally, merge PR #1865 from NoahGorny...and clean it a bit...
2022-01-18 11:02:21 -08:00
John D Pell
9b51dc0b5f
lib/helpers: fix `_command_exists()`
...
The weird subshell is weird AF. Just do a normal `if`.
Ditto `_binary_exists()`, `_completion_exists()`, and `_is_function()`!
2022-01-18 11:02:10 -08:00
John D Pell
180fb93df8
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
```
2022-01-18 11:02:10 -08:00
Noah Gorny
973a1f9b40
Merge pull request #1958 from gaelicWizard/plugin-proxy
...
plugin/proxy: lint
2022-01-18 19:42:32 +02:00
Noah Gorny
e116288b83
Merge pull request #2027 from gaelicWizard/lib/composure
...
Update `vendor/composure`
2022-01-18 19:40:41 +02:00
Noah Gorny
fd35094463
Merge pull request #2004 from gaelicWizard/finalize
...
Create lib finalize hook
2022-01-18 19:40:05 +02:00
Noah Gorny
8d5d9073ce
Merge pull request #1999 from gaelicWizard/utilities
...
lib/utilities: refactor `_bash-it-pluralize-component()` & other improvements
2022-01-18 19:39:45 +02:00
Noah Gorny
bdf9a2bca3
Merge pull request #1959 from gaelicWizard/log
...
Lib/log: linting and small improvements
2022-01-18 19:39:24 +02:00
John D Pell
77c5f8eda9
completion/dotnet: modernize
...
and `shfmt`
2022-01-12 22:39:49 -08:00
John D Pell
1a48bcc852
completion/dotnet: new completion
...
See: https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
2022-01-12 22:20:25 -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
9291b46b15
test_lib: update BATS to latest tag(s)
...
And fix any failing tests.
2022-01-10 00:27:39 -08:00
John D Pell
d4b4995e2a
Update "composure" from " https://github.com/erichs/composure@master "
...
git-vendor-name: composure
git-vendor-dir: vendor/github.com/erichs/composure
git-vendor-repository: https://github.com/erichs/composure
git-vendor-ref: master
2022-01-09 00:54:30 -08:00
John D Pell
7430a06ec2
lib/utilities: Use variable indirection
...
Don't use `local -n var` so that we can support v3.2...
Note: function names and variable names are different namespaces, so we can have a variable named the same as the function...which makes it really easy to predict default names for results when returning this way.
2022-01-09 00:53:39 -08:00
John D Pell
2b5e531396
lib/utilities: update `_bash-it-component-cache-file()`
...
Match idiom of `_bash-it-component-singularize()`
2022-01-09 00:53:39 -08:00
John D Pell
4f700dfb3b
lib/utilities: rewrite _bash-it-component-pluralize
...
Fix up and rename `_bash-it-pluralize-component()` to `_bash-it-component-pluralize()`, and add matching function `_bash-it-component-singularize()`.
2022-01-09 00:53:39 -08:00
John D Pell
c3eaa606de
lib/utilities: fix `_bash-it-component-help()` for long component names
...
Alsö, minor tweak to `_bash-it-array-contains-element()` for clarity.
This fixes Bash-It/bash-it#1978 .
2022-01-09 00:53:39 -08:00
John D Pell
e3bd30f98d
lib/utilities: autonomize `_bash-it-component-item-is-enabled()`
...
Make `_bash-it-component-item-is-enabled()` operate *without* using `_bash-it-component-help()`...so it's now *much* faster.
2022-01-09 00:53:39 -08:00
John D Pell
e71ea4ad02
lib/log: function `_bash-it-log-prefix-by-path()`
...
...to replace `_set-prefix-based-on-path()` in `scripts/reloader`.
Deliberately does not use `_bash-it-get-component-name-from-path()`/`_bash-it-get-component-type-from-path()` as we need some of the intermediate state and would have to reimplement anyway.
2022-01-09 00:49:44 -08:00
John D Pell
6dec28b5df
lib/log: rename `_log_general()`
...
...to `_bash-it-log-message()`.
alsö, add common log levels with common names.
2022-01-09 00:49:44 -08:00
John D Pell
b772e6ace7
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 ♥
2022-01-09 00:49:44 -08:00
John D Pell
dc45958a8e
finalize: first attempt at documentation?
2022-01-09 00:46:51 -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
6e480d7a8a
plugin/proxy: `shellcheck` && `shfmt`
...
plugins/proxy: use `_command_exists()`
Alsö, quote variables, handle unbound parameters, &c.
2022-01-09 00:40:49 -08:00
Noah Gorny
86c1e3c043
Merge pull request #1980 from gaelicWizard/themes-SC2154-B
...
Themes: `shellcheck` (SC2154); Part B
2022-01-09 01:13:49 +02:00
Noah Gorny
f2bff34493
Merge pull request #2013 from gaelicWizard/completion/system
...
completion/system: load earlier than others
2022-01-09 01:13:23 +02:00
Noah Gorny
1fd601db7f
Merge pull request #2007 from gaelicWizard/plugin-latex
...
Plugin/LaTeX: 2009 was thirteen years ago
2022-01-09 01:11:41 +02:00
Noah Gorny
21e7c1f00c
Merge pull request #2011 from gaelicWizard/plugin-nginx
...
plugin/nginx: cleanup
2022-01-09 01:11:06 +02:00
Noah Gorny
af801cfadc
Merge pull request #2014 from gaelicWizard/plugin/gif
...
plugin/GIF: use `type -p` and lint
2022-01-09 01:10:43 +02:00
Noah Gorny
46f343461c
Merge pull request #1953 from gaelicWizard/SVN
...
completion/svn: import existing, remove copy
2022-01-09 01:10:16 +02:00
Noah Gorny
4ec1b5f3e7
Merge pull request #2002 from gaelicWizard/bats
...
tests: path quoting and boilerplate
2022-01-09 01:04:12 +02: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
John D Pell
079652e6e7
plugin/nginx: cleanup
...
Dont overwrite user-set variable, and quote path. Local some variables, `shellcheck`, `shfmt`
2022-01-08 08:44:05 -08:00
John D Pell
2fe9e01051
plugins/latex: 2009 was 12 years ago
...
Locate the currently installed edition, instead of transpoting us back to undergrad.
2022-01-08 08:43:32 -08:00
John D Pell
ce22710e00
plugin/gif: `shfmt`
...
My apologies to future `git blame` hunters ♥
2022-01-08 08:43:17 -08:00
John D Pell
b1b08de626
plugins/gif: use `type -p`
2022-01-08 08:43:00 -08:00
John D Pell
04c7424de5
completion/system: fix tests for `profile` command
2022-01-08 08:33:16 -08:00
John D Pell
5fab574bfd
completion/system: `shfmt`
...
My apologies to future `git blame` hunters ♥
2022-01-08 08:33:16 -08:00
John D Pell
e7c3263f12
completion/system: load earlier than other completions
...
I chose `325` so that it's still possible to deliberately place something *before* this component, if needed somehow.
2022-01-08 08:33:16 -08:00
John D Pell
776d0b7d37
completion/svn: rename to match prior file
...
This way, users don't need to enable "subversion" if they had already enabled "svn".
2022-01-08 08:32:37 -08:00