Commit Graph

3533 Commits

Author SHA1 Message Date
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
John D Pell
2ddb40751f plugin/less-pretty-cat: remove || cat
The logic to run `cat` if `pygmentize` fails seems useless, so just remove it.
2021-09-23 15:42:23 -07:00
John D Pell
84c96665ce completion/wpscan: simplify code flow (whitespace)
Convert from indented if-block to return then unindented code. This should have basically one line change at the top, one line removed at the bottom, and then all whitespace.
2021-09-23 14:51:21 -07:00
John D Pell
5857648377 plugins/less-pretty-cat: simplify code flow
Convert from indented if-block to return then unindented code. This should have basically one line change at the top, one line removed at the bottom, and then all whitespace.
2021-09-23 10:17:28 -07:00
John D Pell
55be49e887 plugins/less-pretty-cat: use _command_exists
Addresses bash-it/bash-it#1632

Alsö, code style cleanup: quote variables, handle unbound parameters,  &c.
2021-09-23 10:17:28 -07:00
John D Pell
e8966ea2a5 lib/helpers: cite _bash-it-find-in-ancestor()
Add `composure.sh` citation with examples and rewrite internal comments to describe the code flow.
2021-09-23 10:00:52 -07:00
Noah Gorny
d6c4c0cc88 Merge pull request #1960 from gaelicWizard/alias-vim
aliases/vim: simplify code flow
2021-09-23 13:50:57 +03:00
John D Pell
7ed12083f2 gradle: adopt _bash_it_find_in_ancestor() 2021-09-22 15:30:07 -07:00
John D Pell
0471a20c7c lib/helpers: new function _bash-it-find-in-ancestor()
New function to do a search looking for a sibling to a parent of the current directory, for example to find `../../.git` to indicate that `$PWD` is inside a git repository.
2021-09-22 15:30:07 -07:00
John D Pell
be90e655f1 completion/laravel: simplify code flow
And apply `shfmt` and fix `shellcheck`
2021-09-22 13:48:10 -07:00
John D Pell
e5e7c7c55b plugin/ruby: add missing parameter error message 2021-09-22 13:37:18 -07:00
John D Pell
8a81fd7271 plugins/ruby: prepare for shellcheck 2021-09-22 13:33:34 -07:00
John D Pell
6e2e945771 aliases/vim: simplify code flow 2021-09-22 13:21:16 -07:00
Noah Gorny
8c697715eb Merge pull request #1938 from gaelicWizard/_command_exists
Use `_command_exists` everywhere
2021-09-20 14:56:45 +03:00
Noah Gorny
4700d7bf05 Merge pull request #1935 from gaelicWizard/next
Remove Executable Bit
2021-09-20 14:49:46 +03:00
Noah Gorny
4984d7adc8 Merge pull request #1834 from NoahGorny/lazily-load-pip
completion: pip: Only invoke pip when trying to complete it
2021-09-20 14:47:41 +03:00
John D Pell
fb6e05d915 completions/sqlmap: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
8a03f451b2 lib/helpers: simplify _command_exists() and _binary_exists()
Remove subshell and just use a regular `if`
2021-09-19 21:58:48 -07:00
John D Pell
a2e32f37c5 theme/dulcie: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
eabdf41b83 lib/theme: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
8e9438d715 completion/hub: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
699720fe8b completion/docker-compose: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
679d8b10b6 completion/gradle: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
0ad1af8306 aliases/apt: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
88d66bbfca aliases/curl: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
6618457f9e aliases/general: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
699d893bef completion/awscli: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
dca96e0c39 completion/consul: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
bb555aefbf completion/pew: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
ef0c64322f completion/travis: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
c98424308a plugins/direnv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
b038ea5869 plugins/nodenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
f0179c79ce plugins/plenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
a31145335e plugins/pyenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
cff6f3464a plugins/rbenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
b14bb4735e plugins/ruby: use _command_exists 2021-09-19 21:58:48 -07:00