Commit Graph

144 Commits (ccd8b52e896f477576b23f03b526897b0e905272)

Author SHA1 Message Date
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
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 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 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 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 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
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
Gurkirat Singh e51fe1fe2b
Abort upgrade if unsaved changes found in bashit directory (#1890)
helper (improvement): added safeguard for unsaved changes
2021-06-23 13:25:42 +03:00
Gurkirat Singh 01b916c544 helpers (bugfix): restart bashit after upgrade 2021-06-11 12:41:28 +05:30
Noah Gorny 7b5f758eba helpers: Fix broken compoure references after vendor change 2021-03-21 21:52:47 +02:00
Noah Gorny 2b66100c47 helpers: Add _completion_exists helper 2021-01-28 17:40:20 +02:00
Noah Gorny 6914a2345a version: Fix url in case it is ssh based one 2020-12-21 00:30:56 +02:00
Noah Gorny e023d6f851 Improve bash-it version output
As we now have "stable" releases and "dev" type of versions, `version` command should
provide usefull output on that
2020-10-27 20:01:50 +02:00
Noah Gorny 825fc88a8f Rename _bash-it_update to _bash-it-update 2020-10-25 15:24:19 +02:00
Noah Gorny 8a36f21ca1 Add _binary_exists and use in github-cli completion
gh was also used as an git alias, and caused _command_exists to not fail as expected
2020-10-21 00:14:11 +03:00
Noah Gorny c387517122
Merge pull request #1626 from NoahGorny/update-to-stable-or-unstable
bash-it update to stable or dev
2020-10-16 14:16:06 +03:00
Noah Gorny a1adfaaa3e lib: helpers: Handle stable revert update 2020-10-13 15:41:28 +03:00
Noah Gorny 6bed26eccb lib: helpers: Rename Upgrading -> Updating 2020-10-13 15:30:19 +03:00
Noah Gorny 0a9b43e86d lib: Fetch from remote before calculating latest tag in bash-it update 2020-10-13 15:30:19 +03:00
Noah Gorny 4ca6dd9a36 helpers: Add --slient option to bash-it update 2020-10-13 14:42:02 +03:00
Noah Gorny 9b208e7d5c lib: Update no-op message in case of stable update 2020-10-13 14:42:02 +03:00
Noah Gorny 8e6876719b lib: Add BASH_IT_DEVELOPMENT_BRANCH variable 2020-10-13 14:42:02 +03:00
Noah Gorny ecf65569ce lib: Update to stable now correctly fails if no tags are present 2020-10-13 14:42:02 +03:00
Noah Gorny 96295e92a5 lib: Improve bash-it update so it can update to latest tag 2020-10-13 14:42:02 +03:00
Noah Gorny f4279e63c1 Add bash-it restart command
Also add completion and completion tests
2020-10-12 15:29:36 +03:00
Noah Gorny 24c05995e7 helpers: Auto reload now only reloads and not reset the shell 2020-10-10 04:02:30 +03:00
cornfeedhobo 97bb1fc7ba
allow the caller to pass a custom log message when the command is not found 2020-08-03 14:20:04 -05:00
Noah Gorny 5daecc9381 lib: Log in case _command_exists fails 2020-06-30 20:58:09 +03:00
Noah Gorny 86824a93ed helpers: Add bash-it doctor command 2020-06-23 15:12:43 +03:00
Noah Gorny 3eac73f613 plugins: Rename gitstatusd plugin to gitstatus 2020-06-22 14:57:05 +03:00
Noah Gorny bda85c3679 lib: Add on-disable-callback for plugins to use 2020-06-22 14:56:13 +03:00
Nils Winkler f29a195f49 Make sed replacements work for both BSD and GNU sed
Fixes #1411
2019-07-31 08:50:33 +02:00
Kyle Welsby ca58587217
Fixes #1203 convert alias to aliases
A ungraceful patch but fixes this one case where the command is singular `alias` while the file are plural with `aliases.
2019-01-16 18:16:08 +00:00
Nils Winkler 792593c995
Merge pull request #1273 from kigster/kig/search/improved
Speed up bash-it Search & support exact matches
2019-01-14 09:05:02 +01:00
Claudia 0fe631ea7c
Make `bash-it reload` preserve working directory
In e5b6869 (part of #1283), a regression was introduced, which caused
`bash-it reload` to return with the working directory set to
`.bash_it` and the original working directory discarded.

The root cause is the function wrapper of `bash-it reload`, which has
always relied on the working directory not to change during execution
of the wrapped code. This assumption no longer holds with the changes
introduced in #1283.

This commit fixes the regression by using `pushd`/`popd` in `bash-it
reload`.
2019-01-02 17:45:43 +01:00
Travis Swicegood 1dadfc92ba
Merge pull request #1283 from Bash-it/bugfix/bash_completion_debian
Bugfix - issue with sourced files (noted by @caguettaz)
2018-12-05 22:07:07 -06:00
Travis Swicegood 0793eb41a7 Ignore SC2139 – it's ok that these are expanded when evaluated 2018-12-05 21:00:41 -06:00
Travis Swicegood 61380e686f Remove unused function 2018-12-05 21:00:09 -06:00
Travis Swicegood e5b68695c0 Attempt to simplify by not using aliases 2018-12-04 22:02:10 -06:00
caguettaz 13b6f3d870 [cleanup] Cleaned escaped newlines for alias reload 2018-12-04 16:31:03 +01:00
caguettaz a1bbecc4a5 [bugfix] Fixed reload aliases 2018-12-04 15:58:21 +01:00
caguettaz e198d8dc3d [bugfix] Fixed config family names for reload aliases 2018-12-04 14:58:13 +01:00
caguettaz f06439edc3 [cleanup] Harmonized variable names, added support for global config files 2018-12-04 14:30:11 +01:00
Travis Swicegood babb1e6675 Adjust to only show merges into master
Adding `--first-parent` ensures that only commits from the master branch
are used when showing the history. I've verified this change directly
by comparing the `rev-list` output for `703105c..97df5c45`:

```console
$ git rev-list --merges 703105c...97df5c4
97df5c4540
b5976ada25
$ git rev-list --merges --first-parent 703105c...97df5c4
97df5c4540
```

Note: I've created this branch from 703105c so that I can merge `master`
into it and test `bash-it update` once merged.
2018-12-03 21:17:49 -06:00
Travis Swicegood 185c2879d5 Update to show the subject if the body is empty 2018-12-02 10:53:56 -06:00
Travis Swicegood 8e7a566d96 Show update prompt when running bash-it update
This utilizes the body of the merged PR requests to show the commits
that are included in this update. It gives the user a chance to
decline the upgrades by pressing n or N.
2018-12-02 10:47:11 -06:00