Commit Graph

3420 Commits (14bfdb5956b7c659bdda13bc87d58af342f14685)

Author SHA1 Message Date
John D Pell 14bfdb5956 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.
2021-09-17 22:25:54 -07:00
John D Pell 3f6ea607b5 themes/agnoster: lint 2021-09-17 22:25:54 -07:00
John D Pell 18c7e72ff5 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.
2021-09-17 22:25:54 -07:00
John D Pell 94c2ea60cc lib/theme: fix SC2155, SC2154, SC2034 2021-09-17 22:25:53 -07:00
John D Pell 4af7e9abd0 Move `.shellcheckrc` under `themes/` 2021-09-16 17:06:46 -07:00
John D Pell d91525be3f completion/composer: lint 2021-09-16 17:06:46 -07:00
John D Pell a4fe6267b6 completion/sdkman: lint 2021-09-16 17:06:46 -07:00
John D Pell 86d63e3c6a completion/knife: lint 2021-09-16 17:06:46 -07:00
John D Pell f1fbc1d1b6 completion/knife: lint false positives 2021-09-16 17:06:46 -07:00
John D Pell 0ce5fe9427 completion: lint completions using `bash_completion` functions
Match the style of the existing code
2021-09-16 17:06:46 -07:00
John D Pell 91d1afc810 plugins/alias-completion: fix SC2155, SC2154
Declare `locals` at the top of the function
2021-09-16 17:06:46 -07:00
John D Pell 6b83a3a743 plugins/alias-completion: lint false positives 2021-09-16 17:06:46 -07:00
John D Pell 6b54afe765 plugins/goenv: lint 2021-09-16 17:06:46 -07:00
John D Pell 21f8cdca06 plugins/git: lint 2021-09-16 17:06:46 -07:00
John D Pell 54200c372f plugins/xterm: lint 2021-09-16 17:06:46 -07:00
John D Pell 11d7115962 plugins/cmd-returned-notify: don't `export` 2021-09-16 17:06:46 -07:00
John D Pell f7bc3324fa install: lint 2021-09-16 17:06:46 -07:00
John D Pell a76731dad3 main: lint false positive 2021-09-16 17:06:46 -07:00
John D Pell b6d54b458b 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/
2021-09-16 17:06:46 -07:00
Noah Gorny f9de8d170a
Merge pull request #1941 from gaelicWizard/themes_autosave
Themes: use `_save-and-reload-history()`
2021-09-16 21:22:21 +03:00
Noah Gorny 99eab7a76c
Merge pull request #1936 from NoahGorny/fix-shellcheck-warnings
plugins: Fix shellcheck warnings on already linted files
2021-09-12 08:13:44 +03:00
John D Pell 9d656747a9 themes: remove executable bit 2021-09-11 21:25:14 -07:00
John D Pell ffe15ebfe0 themes: use `_save-and-reload-history()`
First pass to use _Bash It_'s automatic history management.
2021-09-11 21:25:14 -07:00
Noah Gorny f0690c09fb
Merge pull request #1939 from Bash-it/revert-1767-disable-macos-11
Reinstate macOS 11 job
2021-09-11 16:43:36 +03:00
Noah Gorny ec3b8d645f
Revert "ci: Remove macos-11.0 as it is unreliable" 2021-09-10 16:54:51 +03:00
Noah Gorny c6f6d8c27a plugins: Fix shellcheck warnings on already linted files 2021-09-09 20:57:03 +03:00
Noah Gorny 9ea60020ae
Merge pull request #1915 from gaelicWizard/bash_completion
Support multiple versions of _Bash Completion_
2021-09-07 10:12:12 +03:00
John D Pell feacd560b6 completion/system: update wording on shell version 2021-09-05 15:43:05 -07:00
John D Pell ecfcaba32e completion/system: accomodate multiple versions
For Homebrew, switch between v1 and v2 of bash-completion based on whether the running Bash shell is new enough to use v2.
2021-09-05 15:43:05 -07:00
Noah Gorny 5782325dea
Merge pull request #1903 from gaelicWizard/unbound
Gracefully handle unbound parameters
2021-08-31 20:16:26 +03:00
John D Pell 85408743fa lib/log: default to no logging at all
Set the default when BASH_IT_LOG_LEVEL is unbound to log level none: no warnings or errors are reported at all.
2021-08-26 14:11:41 -07:00
John D Pell 3654198deb Tests for 'default' prefix 2021-08-26 14:11:41 -07:00
John D Pell 0c412442f5 completion/system: give up hope
Give up and accept defeat that bash-completion can't reasonably be audited for unbound parameters. Wrap invocation with disabling strictness, and restore after if it was enabled.
2021-08-26 14:11:41 -07: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 bd9f4015a7 lib/helpers: handle unset parameter
Expressly handle $BASH_IT_REMOTE as blank when variable is not set.
2021-08-26 14:11:41 -07:00
John D Pell 8fb75cf0e3 lib/helpers: handle unbound parameter
Expressly handle $BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE being not-set as being blank.
2021-08-26 14:11:41 -07:00
John D Pell 0eff44930c lib/utilities: handle unbound parameter
Expressly handle unbound $BASH_IT_GREP when testing for value
2021-08-26 14:11:41 -07:00
John D Pell 233fcc3091 lib/log: handle undefined variable
Expressly deal with if $echo_yellow hasn’t been defined
2021-08-26 14:11:41 -07:00
John D Pell f71fa5be2c Handle unbound variables
Handle BASH_IT, BASH_IT_OLD_BASH_SETUP, BASH_IT_THEME, BASH_THEME, and PROMPT.
2021-08-26 14:11:41 -07:00
John D Pell 5001995e92 Deal with unabound BASH_IT_RELOAD_LEGACY 2021-08-26 14:11:41 -07:00
John D Pell bcd67db4ab lib/preview: handle unbound parameter
If $BASH_PREVIEW is unset, treat it as blank.
2021-08-26 14:11:41 -07:00
John D Pell 02c13b7921 lib/log: handle undefined variables
If the user hasn't defined BASH_IT_LOG_LEVEL, then the integer comparison fails. Handle it by defaulting to '1'.
If lib/log is loaded improperly, the BASH_IT_LOG_PREFIX may be undefined. Unlikely, but no harm in handling it too.
Likewise, if no theme is loaded, then $echo_green, $echo_normal, et al are not defined.
2021-08-26 14:11:41 -07:00
Noah Gorny 8b3867fe35
Merge pull request #1910 from gaelicWizard/brew
lib/helpers: new function to set BASH_IT_HOMEBREW_PREFIX
2021-08-26 22:17:57 +03:00
John D Pell 0f28824ad5 lib/helpers: invert test in _bash_it_homebrew_check()
Check if `brew` is installed every time, and *unset* `$BASH_IT_HOMEBREW_PREFIX` if not found. This accounts for the edge-case of a user _uninstalling_ Homebrew without restarting the shell.
2021-08-22 12:48:48 -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 9e255c2139 lib/helpers: new function to set BASH_IT_HOMEBREW_PREFIX
New function `_bash_it_homebrew_check()` sets global variable `$BASH_IT_HOMEBREW_PREFIX` using `brew --prefix` if `brew` exists as a valid command. If `brew` isn't installed, then return failure.

Plugins can test for `brew` by calling this function and, if it succeeds, they can rely on `$BASH_IT_HOMEBREW_PREFIX` being defined properly.
2021-08-22 12:48:48 -07:00
Noah Gorny 226454b069
Merge pull request #1921 from NoahGorny/fix-update-not-popping-back-cwd
fix update not popping back cwd
2021-08-18 21:17:11 +03:00
Noah Gorny 9566a3ec18 helpers: Improve pull_and_update_inner by restoring old pwd
Renamed the function to _bash-it_update_migrate_and_restart
Use pushd/popd instead of passing another parameter
Document the function so it will be clear that it does not return
2021-08-18 00:29:45 +03:00
Noah Gorny caec973c18 helpers: Pop pwd correctly when not needing to update 2021-08-17 23:50:58 +03:00
Noah Gorny 9cc36de58e
Merge pull request #1918 from NoahGorny/fix-defaults-completion
defaults: Revert to old comparison
2021-08-17 23:36:19 +03:00