Commit Graph

642 Commits (1722ea963e7af8f7b0cbc674ee57dd35d0ef7d45)

Author SHA1 Message Date
John D Pell dc5c9e107c plugin/man: simplify
Don't overwrite variables that the user has already set.

plugins/man: unbound `$LESS`
2022-01-01 17:49:45 -08:00
John D Pell 290aab4efe plugins/man: Add "R" to `$LESS`
Otherwise, `-R` must be added on the command line or colors just won't be rendered and these variables will be ignored.
2022-01-01 17:49:45 -08:00
John D Pell 8b308df939 plugin/dirs: use `$BASH_IT_DIRS_BKS.new` instead of `~/.dirs1` 2022-01-01 17:49:15 -08:00
John D Pell 71b4f3c1bc plugin/dirs: `shfmt` && `shellcheck` 2022-01-01 17:49:15 -08:00
John D Pell d8e7b173b5 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.
2022-01-01 17:49:15 -08:00
Noah Gorny 2e51e92699
Merge pull request #2000 from gaelicWizard/lint
Revert most of "Fix linting errors that snuck in."
2022-01-01 23:01:09 +02:00
Noah Gorny 2dd4426a7c
Merge branch 'master' into plugin-java 2022-01-01 22:53:18 +02:00
John D Pell 33df3a2bcd plugin/java: show message on missing *or* blank 2021-12-30 22:35:34 -08:00
John D Pell f03a89836e plugins/java: quote path && `shfmt`
Provides an error message if no file is specified.
2021-12-30 20:25:19 -08:00
Kostas Giapis 1c03eb6b3b Fix checking whether fzf is already in PATH 2021-12-28 06:54:25 +02:00
John D Pell 64f75ce22d Revert most of "Fix linting errors that snuck in."
This reverts commit 2c8ee40566.

- _Shellcheck_ documentation for the [`source-path`]( https://github.com/koalaman/shellcheck/wiki/Directive#source-path ) directive indicates this is correct usage. We're `source`ing the `bash-preexec.sh` file from inside the `vendor/github.com/rcaloras/bash-preexec` directory. If we used the [`source`]( https://github.com/koalaman/shellcheck/wiki/Directive#source ) directive, then the full complete path to the file itself would need to be specified.
- Fix `disable=1090` to `disable=SC1090` and remove duplicate lines since this `shellcheck` directive will apply to the entire if-ladder.
- Disabling `SC2154` is almost never appropriate. In this case, several `_git_bash_completion*` variables are expressly assigned in this file, so there is no "unknown" to ignore.

Aside: the `${!_git_bash_completion@}` construct will expand to all variables starting with the previx `_git_bash_completion`, so this line is just a shorthand way to clear all our variables concisely without forgetting any.
2021-12-27 16:18:20 -08:00
John D Pell 3fe9c8d6bc plugin/jekyll: try to shorten the flow
Alsö, use `pushd`/`popd` instead of `builtin cd`.

Alsö, SC2153
2021-12-27 12:22:42 -08:00
John D Pell e38eeefc5f plugin/jekyll: second `shellcheck` pass 2021-12-27 12:22:42 -08:00
John D Pell c0aad51afd main: move Jekyll stuff to plugins/jekyll
If the user doesn't load the Jekyll plugin, then don't load any Jeykll stuff.
2021-12-27 12:22:42 -08:00
John D Pell 1c3a7ffdb3 plugin/jekyll: `shfmt` && `shellcheck`
Use bashisms, remove suplerfous variable, use parameter default value replacement
2021-12-27 12:22:42 -08:00
David Farrell 1bc56b1d8f
plugin(dirs): remove shopt -s cdable_vars 2021-12-02 13:42:29 -08:00
cornfeedhobo 2c8ee40566
Fix linting errors that snuck in. 2021-12-02 09:14:01 -06:00
cornfeedhobo bdb5289660
Wholesale cleanup of all history plugins
- remove the use of redundant cite
- minor cleanups to history.plugin.bash
- set explicit load orders for history-search and history-substring-search
- add new plugin history-eternal
- replace superfluous trap for managing HISTTIMEFORMAT changes
2021-12-02 09:13:56 -06:00
Ajeet D'Souza a89f2f8f13 plugin: add zoxide 2021-11-24 16:49:46 +05:30
John D Pell bdfb987f0c plugin/xterm: don't rely on `$1`
_bash-preexec_ passes the "current" command line as `$1`, but this is unreliable and we explicitly discourage it's use.

Use `$BASH_COMMAND` instead.
2021-10-20 15:50:15 -04: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
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 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 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
John D Pell a4e4f30ff1 plugins/percol: `bind`
Move `bind` below function definition
2021-09-26 11:54:32 -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 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 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 7ed12083f2 gradle: adopt `_bash_it_find_in_ancestor()` 2021-09-22 15:30:07 -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 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
John D Pell ccd8b52e89 plugins/virtualenv: use `_command_exists` 2021-09-19 21:58:48 -07:00
John D Pell de58fdd73f plugins/autojump: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell 39d6488c6b plugins/base: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell 3e2ec1232d plugins/hub: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell 635e5488ba plugins/jump: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:58:47 -07:00
John D Pell e701660ff1 plugins/node: use `_command_exists`
Addresses bash-it/bash-it#1632

alsö, quote variable, use `[[`, &c.
2021-09-19 21:54:21 -07:00
John D Pell 9378a8318f plugins/nvm: use `_command_exists`
Addresses bash-it/bash-it#1632

alsö, quote variable, &c.
2021-09-19 21:54:00 -07:00
John D Pell a7955b972c plugins/powerline: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:53:59 -07:00
John D Pell f6c5717a7a plugins/textmate: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:52:46 -07:00
John D Pell a375e7131e Remove executable bit 2021-09-18 22:26:27 -07:00
John D Pell 5fc418e479 Use `${PWD}` instead of `$(pwd)`
Don't subshell when there's a shell parameter for it.
2021-09-18 13:15:13 -07:00
John D Pell 1f6d6aa147 Use `$PWD` instead of `\`pwd\``
Don't subshell when there's a shell parameter for it.
2021-09-18 13:14:52 -07:00
Noah Gorny 0dbf1d593c
Merge pull request #1926 from gaelicWizard/basenamed
Use parameter substitution instead of `dirname`/`basename`, where safe to do so
2021-09-18 18:26:55 +03:00
John D Pell 1c3cbf7ca6
Delete `.shellcheckrc` (#1947)
* CI: disable Ubuntu 16.04 as it's EOL

https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/

* main: lint false positive

* install: lint

* plugins/cmd-returned-notify: don't `export`

* plugins/xterm: lint

* plugins/git: lint

* plugins/goenv: lint

* plugins/alias-completion: lint false positives

* plugins/alias-completion: fix SC2155, SC2154

Declare `locals` at the top of the function

* completion: lint completions using `bash_completion` functions

Match the style of the existing code

* completion/knife: lint false positives

* completion/knife: lint

* completion/sdkman: lint

* completion/composer: lint

* Move `.shellcheckrc` under `themes/`

* lib/theme: fix SC2155, SC2154, SC2034

* lib/colors: don't warn on unused variables

We assign a large number of variables here and they may or may not be used anywhere else, so disable SC2034 for this file (only).

Alsö disable SC2005 as the functions in this file were written before `printf` was invented and have to do some fancy metascripting to get escape sequences interpreted reliably. I’m not smart enough to fix this to use `printf`, so leave it for now.

* themes/agnoster: lint

* themes: disable SC2154 for colors

Each one of these themes will need it’s own fix for SC2154, possibly upstream.

Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.

* themes: disable SC2154, fix SC2155

Each one of these themes will need it’s own fix for SC2154, possibly upstream.

Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.

* Delete `.shellcheckrc`

* remove executable bit
2021-09-18 12:50:59 +03:00
John D Pell 470341b23a Drop `basename` in favor of Bash strings
Convert `var=$(basename $file)` to `var="${file##*/}"`
2021-09-16 16:59:02 -07:00
John D Pell dee55a03cc drop `dirname` in favor of native Bash strings (1 of 2)
Convert `var=${dirname $filename)` to `var="${filename%/*}` in cases where there is no ambiguity.

Make sure that the path in `$BASH_IT` is absolute because this path gets embedded in the template `.bash_profile` file if selected by the user.
2021-09-16 16:59:02 -07:00
Noah Gorny c6f6d8c27a plugins: Fix shellcheck warnings on already linted files 2021-09-09 20:57:03 +03:00
John D Pell cd65e0925f plugins/base: unbound BASH_IT_LEGACY_PASS
Expressly handle as blank when $BASH_IT_LEGACY_PASS is not set.
2021-08-26 14:11:41 -07:00
John D Pell 65ef8e2e8b Use _bash_it_homebrew_check() in plugins, completions
Use new function `_bash_it_homebrew_check()` in existing plugins and completions which look for Homebrew.

Alsö, use `$OSTYPE` instead of calling external `uname` binary.
2021-08-22 12:48:48 -07:00
John D Pell de9ea54b81
Don't call external `uname` when `$OSTYPE` will do (#1911)
* lib/helpers: use `$OSTYPE` instead of `$(uname)`

* plugins/osx: use `$OSTYPE` instead of `$(uname)`

* plugins/boot2docker: use `$OSTYPE` instead of `$(uname)`

* plugins/python: use `$OSTYPE` instead of `$(uname)`

* plugins/base: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[` as the former has less insane argument handling being shell syntax rather than a builtin command that must emulate being a real binary

* completion/brew: use `$OSTYPE` instead of `$(uname)`

* completion/git: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[`.

* completion/fabric: use `$OSTYPE` instead of `uname`

* theme/demula: use `$OSTYPE` instead of `$(uname)`

* theme/rana: use `$OSTYPE` instead of `$(uname)`
2021-08-14 10:20:12 +03:00
Noah Gorny 2120be9372 plugins: Fix alias-completion by using helper util
By using _bash-it-array-contains-element, we can safetly iterate over
elements in the $completions array
2021-05-15 11:42:10 +03:00
Noah Gorny 1b7448bc9d plugins: alias-completion: Revert back to read without -r 2021-04-22 20:38:30 +03:00
John Fred Fadrigalan 7b8dbd39bc
Clean alias completion plugin (#1872)
* Sort plugins/available

* Clean alias-completion plugin

* Fix shellcheck warning. SC1090

* Change shellcheck source to /dev/null for explicity

* Disable shellcheck warning SC2162
2021-04-22 01:46:50 +03:00
Bingzhang Dai 7331cd2676
Update extract.plugin.bash 2021-03-24 18:42:44 +08:00
Bingzhang Dai 399b5199b0
Update extract.plugin.bash, support to extract zip to target directory 2021-03-24 17:04:21 +08:00
Noah Gorny 75058ebf22 plugins: git: Fix git_stats
Also remove uneeded newline
2021-02-06 00:26:15 +02:00
Gurkirat Singh 5cb52fa239 fixed linting for `plugins/available/git.plugin.bash` file 2021-02-06 00:26:15 +02:00
Gurkirat Singh 77654875e5 fixed git-changelog plugin 2021-02-06 00:26:12 +02:00
Gurkirat Singh 63f9f660a9 credit given to original author 2021-02-06 00:25:33 +02:00
Gurkirat Singh 92d814b2f6 added plugin to create git changelog and formatted code 2021-02-06 00:25:33 +02:00
cornfeedhobo e690f21e4e
Ensure goenv and go play together well
This PR seeks to address several issues surrounding the go and goenv plugins.
The nature of goenv allows for a situation where the initial shell does not
point to a working go binary, and instead at the included shim script. The
result is that one must run reload after moving to a project directory with a
version file, however in doing so, PATH is updated, requiring they exit the
shell or risk lookup collisions and unexpected behavior.

This is solved by using preexec to check the version before changing
directories and restarting the shell if the version has changed. The exec
pattern is copied from _bash-it-restart, but is edited to support this specific
use case.

Additionally, tests have been uploaded and these are now being linted.
2021-02-04 23:51:17 -06:00
Noah Gorny e8dc0f7434 deprecation: Replace errors with warnings
Deprecated component is not an error, but instead should be a warning to
the user
2021-01-29 16:06:53 +02:00
Noah Gorny 2500fe7dda docker-machine: Deprecate both plugin and completion file 2021-01-29 16:06:51 +02:00
Noah Gorny 046e528cc2 plugins: xterm: Fix shfmt complaints 2021-01-23 22:47:15 +02:00
buhl 29855ed1e6 Adding preexec as a vendored library
Added a vendored lib loading routine in bash-it.sh
Added documentation on how to vendor libs in bash-it
Added and fixed plugins using preexec
Added tests for two plugins
Removed the old preexec lib
2021-01-23 18:31:18 +01:00
cornfeedhobo 4044f4123c
add top-history 2021-01-15 11:57:41 -06:00
cornfeedhobo 61f727fb96
refactor all history modifications into discrete plugins 2021-01-15 11:53:28 -06:00
David Farrell e932d8371f
Add hooks to check .sh and .bash headers - Fixes #1491 (#1765)
* Add hooks to check .sh and .bash headers
* Adds hooks/ to clean_files.txt
2021-01-09 18:02:26 +02:00
cornfeedhobo 0b6ecf705d
add plugin for basher 2021-01-02 23:05:05 -06:00
Noah Gorny 1c05d71819 alias-completion: Use 'command rm' instead of rm to avoid aliases 2020-12-14 01:25:58 +02:00
Ira Abramov 3a1283dad5 Fix EOF 2020-10-29 19:57:14 +02:00
Ira Abramov c42e3e8b21 Removed trailing whitespaces 2020-10-29 19:57:14 +02:00
Ira Abramov b82a827ae6 Fix the commandline for gifski 2020-10-15 09:19:13 +03:00
Noah Gorny 92a1310bc2 Remove deprecated and unused gh completion/plugin 2020-10-10 02:54:58 +03:00
Noah Gorny 91b6561e93 gitstatus: Add informative warning in case dir is not found 2020-09-05 22:52:19 +03:00
cornfeedhobo 6b66fbf88c
clean up jenv to follow the newer pattern 2020-07-30 07:50:35 -05:00
Nils Winkler 43ef48544d
Merge pull request #1627 from NoahGorny/fix-alias-completion-plugin
plugins: Fix quotes around prec_word agruments
2020-07-15 08:54:56 +02:00
Nils Winkler f8d1a1c2d7
Merge pull request #1642 from cornfeedhobo/projects-logging
Projects logging
2020-07-13 11:11:35 +02:00
Nils Winkler 68cd78db29
Merge pull request #1639 from cornfeedhobo/cleanup-fzf-plugin
Minor cleanups to fzf plugin
2020-07-13 10:10:30 +02:00
cornfeedhobo 67d359d615
attempt to simplify the description 2020-07-12 16:21:14 -05:00
cornfeedhobo cf47e1f93e
nit pick spacing 2020-07-12 12:37:00 -05:00
cornfeedhobo ca409b699d
minor cleanups to fzf plugin 2020-07-12 12:33:29 -05:00
cornfeedhobo 1c06c0ab61
cleanup node plugin, and make it play nice with nodenv 2020-07-08 11:32:12 -05:00
Noah Gorny a224d65f5b plugins: Fix quotes around prec_word agruments 2020-06-24 15:11:49 +03:00
Noah Gorny a697fd2c53 plugins: Tidy gitstatus plugin comments and code 2020-06-22 14:57:06 +03:00
Noah Gorny d7aebe17a3 plugins: Rename SCM_GIT_GITSTATUS_PLUGIN_SH_LOC to SCM_GIT_GITSTATUS_DIR
Also fix the destructor in case plugin did not load as expected
2020-06-22 14:57:06 +03:00
Noah Gorny 3eac73f613 plugins: Rename gitstatusd plugin to gitstatus 2020-06-22 14:57:05 +03:00
Noah Gorny 6294797986 Rename SCM_GIT_GITSTATUSD_LOC to SCM_GIT_GITSTATUSD_PLUGIN_SH_LOC 2020-06-22 14:56:13 +03:00