Commit Graph

3531 Commits (061cca5304b3b35e5daa4be37668b055b038a608)

Author SHA1 Message Date
nickl- 061cca5304 Readjust output based on single char input strategy 2021-11-19 03:00:41 +02:00
nickl- c78251fc27 Jekyll prompt use single char input 2021-11-19 03:00:41 +02:00
nickl- 6b2eff2f0f Use bash string parsing in favour of basename 2021-11-19 03:00:39 +02:00
nickl- f5268d91ff Fix minor glitch introduced by string concatenation 2021-11-19 02:58:36 +02:00
nickl- bb1452bb84 We do insist though, you locate us at ~/.bash_it 2021-11-19 02:58:36 +02:00
nickl- 19fe69e566 What if .bash_profile doesn't exist?
We get an error from cp
We still respond that we made a backup
Instead if .bas_profile exists and cp is a success then prompt informing the user that we made a backup
or inform them that no .bash_profile was found so no need to make a back up at this point.
2021-11-19 02:58:33 +02:00
nickl- d4d3d8c9e8 Where did my original .bash_profile go?
It's nice that we make a backup but…
 * what if a back-up already exists?
 * what if this is the 2nd, 3rd or 4th time I'm executing the script?

We backup to .bash_profile.bak or .bash_plofile.bak.{count} if .bash_plofile.bak already exists.
iow
.bash_plofile.bak if not exist
.bash_plofile.bak.1 if exists
.bash_plofile.bak.2 if 2 exists
.bash_plofile.bak.3 if 3 exists etc…

Newest backup with the highest number.
2021-11-19 02:57:41 +02:00
nickl- 3ecc3a6038 Then use $BASH_IT
Now that we've gone through all that trouble to define $BASH_IT lets use it then.
2021-11-19 02:57:07 +02:00
nickl- b547b107bc Deduce $BASH_IT relative to install script location at execution
Instead of assuming it is located at ~/.bash_it which might very well not be the case
2021-11-19 02:55:47 +02:00
nickl- 6f0a147c01 Fix code style
At least a general conformance to the same style if nothing else
Based on what appeared to be the most used or most sensible conventions which lead to the following
Braces around variables
Preserve quotes and quote paths
statements begin on the same line
No trailing white space
Respect 120 chars page width at least
Use brackets instead of back-ticks
Two space indent 4 space continuation
No logic was harmed in the making of this commit.
2021-11-19 02:53:31 +02:00
Noah Gorny 447c89aa0e
Merge pull request #1981 from william-richard/make-default-branch-match-exactly-main
Look for branches that are literally the word main
2021-11-16 20:09:22 +02:00
William Richard 2a23598873
Make the regex looking for the main branch match the entire line 2021-11-15 12:19:05 -05:00
Noah Gorny 7b4056fdf9
Merge pull request #1984 from NoahGorny/docs-pin-docutils
docs: Pin docutils to 0.17.1
2021-11-13 20:25:33 +02:00
Noah Gorny 1ff2497c9e docs: Pin docutils to 0.17.1
Seems like docutils 0.18 has some problems and it is breaking our docs
build
(https://issues.apache.org/jira/browse/FLINK-24662)

Lets use 0.17.1 for now.
2021-11-12 19:14:22 +02:00
Noah Gorny ab3b8b8f22
Merge pull request #1979 from gaelicWizard/preexec-histcontrol
preexec: work around upstream mangling of `$HISTCONTROL`
2021-11-01 23:25:02 +02:00
William Richard daaab1b73d
Use \s instead of \b
\b matches things like - and _, which is often used in branch names
2021-10-25 11:55:26 -04:00
William Richard 98bd0ae149
Use `/b` to find the default branch, instead of start/end of line 2021-10-25 11:35:19 -04:00
Noah Gorny c90a6283ef
Merge pull request #1976 from gaelicWizard/utilities
Use `_bash-it-egrep()`
2021-10-23 23:33:04 +03:00
William Richard a14d9cb6ea
Look for branches that are literally the word main
I have a repo with many other branches that contain the string `main`,
but our default branch is still master.  This grep was seeing those other branches
and deciding that my default branch was `main`.  This tighter regex
fixes that behavior for me.
2021-10-22 11:19:21 -04:00
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
John D Pell 9ce199c251 preexec: set options before load
By setting `__bp_delay_install`, we avoid any immediate initialization at all. We then override two troublesome functions before calling `__bp_install_after_session_init()`.

The `__bp_install_after_session_init()` function doesn't enable the DEBUG trap, just sets `$PROMPT_COMMAND` to include `__bp_install()`, so the actual final `$PROMPT_COMMAND` is not finished, and DEBUG trap set, until after the first prompt is displayed.
2021-10-20 15:28:59 -04:00
John D Pell 00f5f2a62e Use `_bash-it-egrep()` 2021-10-18 22:08:56 -04:00
Noah Gorny 2d1bd82575
Merge pull request #1975 from krapshsa/krapshsa-patch-1
Fix save-and-reload-history command not found
2021-10-18 22:22:21 +03:00
Noah Gorny 5e3810ac96
Merge pull request #1973 from gaelicWizard/utilities
lib/utilities: minor improvements
2021-10-18 22:05:05 +03:00
Noah Gorny 5feebcc9d9
Merge pull request #1974 from zou000/patch-1
Fix home dir substitution
2021-10-18 21:59:59 +03:00
krapshsa b0e8729b0f
Fix save-and-reload-history command not found 2021-10-19 00:58:01 +08:00
John D Pell 253d1213e0 lib/utilities: new function `_bash-it-egrep()`
The existing function `_bash-it-grep()` is weird. New function `_bash-it-egrep()` just does the thing without requiring two subshells and manual invocation.
2021-10-18 09:14:32 -04:00
John D Pell b8ee63c67d lib/utilities: quote SC2295
Doesn't show up on my shellcheck 0.7.2, but does for NoahGorny!
2021-10-18 09:14:32 -04:00
John D Pell b986c39040 lib/utilities: XDG_CACHE_HOME
Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.

This resolves Bash-It/Bash-It#1904.
2021-10-18 09:14:32 -04:00
Noah Gorny 7987e4bfcd
Merge pull request #1883 from seefood/ira/autosave-history-plml
Add history flushes on each command to the powerline themes
2021-10-17 19:51:56 +03:00
zou000 7911f770cf
use `\w` 2021-10-16 22:29:25 -07:00
zou000 bb3a51f742
Update powerline.base.bash 2021-10-16 20:24:07 -07:00
zou000 413d7a1326
Fix home dir substitution
See the discussions in 953e422bed (commitcomment-58148656) . Tested with bash 5.1 and  bash 3.2
2021-10-16 19:15:00 -07:00
John D Pell 7cd02781f8 lib/utilities: `_bash-it-component-help()`
No need to `rm` when we overwrite the file the line after next. Alsö, use `>|` in case the user sets `noclobber`; we do expressly intend to overwrite the file in this case.
2021-10-13 21:13:45 -07:00
John D Pell f7cc442af4 lib/utilities: simplify `_bash-it-array-dedup()`
alsö fix usage example of `_bash-it-array-contains-element()`
2021-10-13 09:28:21 -07:00
Noah Gorny 48c17e95c3
Merge pull request #1968 from gaelicWizard/oops
theme/powerline: fix an oops in the last patch
2021-10-12 23:26:17 +03:00
John D Pell 953e422bed theme/powerline: fix an oops in the last patch
The tilde should not have been escaped, and in fact I did not have it escaped in my main branch, but the PR I submitted did have it escaped and...now it shows up in the prompt line for all the PowerLine themes... oops.
2021-10-12 11:08:37 -07:00
Ira Abramov d6239cf190 Merge branch 'master' of https://github.com/bash-it/bash-it into ira/autosave-history-plml
* 'master' of https://github.com/bash-it/bash-it: (114 commits)
  ci: Bump go to 1.17 from 1.14
  skip go tests when go is not available
  plugins: Add ble.sh plugin
  clean up pyenv plugin
  Lint: prepare `lib/utilities` for `shellcheck` (#1933)
  plugin/base: improvements (#1930)
  plugins/percol: `bind`
  completion/git: `shfmt` && `shellcheck`
  completion/git: expand search range
  plugin/percol: `shellcheck` & `shfmt`
  plugins/percol: use `_command_exists`
  completion/pip: simplify code flow
  plugin/less-pretty-cat: remove `|| cat`
  completion/wpscan: simplify code flow (whitespace)
  plugins/less-pretty-cat: simplify code flow
  plugins/less-pretty-cat: use `_command_exists`
  lib/helpers: cite `_bash-it-find-in-ancestor()`
  gradle: adopt `_bash_it_find_in_ancestor()`
  lib/helpers: new function `_bash-it-find-in-ancestor()`
  completion/laravel: simplify code flow
  ...
2021-10-11 08:32:15 +03:00
Noah Gorny 49698e269a
Merge pull request #1971 from NoahGorny/ci-update-go-version
ci: Bump go to 1.17 from 1.14
2021-10-10 23:58:08 +03:00
Noah Gorny adab880f89 ci: Bump go to 1.17 from 1.14 2021-10-10 23:50:39 +03:00
Ira Abramov c3d333ddc4 fix based on remarks on PR 2021-10-10 15:25:45 +03:00
Noah Gorny cf08fcaff2
Merge pull request #1965 from gaelicWizard/completion-git
completion/git: improvements and linting
2021-10-07 00:10:47 +03: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
cornfeedhobo 07384bcf7c
Merge pull request #1967 from cornfeedhobo/goenv-go-tests
skip go tests when go is not available
2021-09-30 07:34:05 -05:00
cornfeedhobo b7feb14404
skip go tests when go is not available 2021-09-29 18:16:52 -05: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 008c2b30ac
Merge pull request #1885 from cornfeedhobo/pyenv-path
clean up pyenv plugin
2021-09-28 16:49:21 +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 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