Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bash-it/bash-it into ira/…
Browse files Browse the repository at this point in the history
…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` (Bash-it#1933)
  plugin/base: improvements (Bash-it#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
  ...
  • Loading branch information
seefood committed Oct 11, 2021
2 parents c3d333d + 49698e2 commit d6239cf
Show file tree
Hide file tree
Showing 134 changed files with 1,168 additions and 995 deletions.
5 changes: 3 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ insert_final_newline = true
trim_trailing_whitespace = false

[.git*]
indent_size = tab
indent_style = tab

[{**.*sh,test/run}]
indent_size = tab
indent_style = tab
indent_size = 4

shell_variant = bash
binary_next_line = true # like -bn
switch_case_indent = true # like -ci
space_redirects = true # like -sr
keep_padding = false # like -kp
keep_padding = false # like -kp
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
bats-test:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-10.15]
os: [ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11.0]

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.17
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending
- id: check-added-large-files
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.4
rev: 2.1.5
hooks:
- id: git-check # Configure in .gitattributes
- id: shellcheck
Expand Down
6 changes: 0 additions & 6 deletions .shellcheckrc

This file was deleted.

5 changes: 3 additions & 2 deletions aliases/available/apt.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
# shellcheck shell=bash
#
# -binaryanomaly

Expand All @@ -8,7 +8,8 @@ about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'
# set apt aliases
function _set_pkg_aliases()
{
if [ -x $(which apt) ]; then
if _command_exists apt
then
alias apts='apt-cache search'
alias aptshow='apt-cache show'
alias aptinst='sudo apt-get install -V'
Expand Down
3 changes: 2 additions & 1 deletion aliases/available/curl.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ about-alias 'Curl aliases for convenience.'
# set apt aliases
function _set_pkg_aliases()
{
if [ -x $(which curl) ]; then
if _command_exists curl
then
# follow redirects
alias cl='curl -L'
# follow redirects, download as original name
Expand Down
4 changes: 2 additions & 2 deletions aliases/available/general.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ then
alias grep='grep --color=auto'
fi

if which gshuf &> /dev/null
if _command_exists gshuf
then
alias shuf=gshuf
fi
Expand Down Expand Up @@ -65,7 +65,7 @@ alias -- -='cd -' # Go back
alias h='history'

# Tree
if [ ! -x "$(which tree 2>/dev/null)" ]
if ! _command_exists tree
then
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
fi
Expand Down
27 changes: 18 additions & 9 deletions aliases/available/git.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ alias gcb='git checkout -b'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcobu='git checkout -b ${USER}/'
alias gcom='git checkout master'
alias gcpd='git checkout master; git pull; git branch -D'
alias gcom='git checkout $(get_default_branch)'
alias gcpd='git checkout $(get_default_branch); git pull; git branch -D'
alias gct='git checkout --track'

# clone
Expand All @@ -64,13 +64,14 @@ alias gf='git fetch --all --prune'
alias gft='git fetch --all --prune --tags'
alias gftv='git fetch --all --prune --tags --verbose'
alias gfv='git fetch --all --prune --verbose'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/$(get_default_branch)'
alias gup='git fetch && git rebase'

# log
alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative'
alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\'''
alias ggs='gg --stat'
alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' # FROM https://stackoverflow.com/questions/39220870/in-git-list-names-of-branches-with-unpushed-commits
alias gll='git log --graph --pretty=oneline --abbrev-commit'
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
alias gwc='git whatchanged'
Expand Down Expand Up @@ -104,15 +105,15 @@ alias gp='git push'
alias gpd='git push --delete'
alias gpf='git push --force'
alias gpo='git push origin HEAD'
alias gpom='git push origin master'
alias gpom='git push origin $(get_default_branch)'
alias gpu='git push --set-upstream'
alias gpunch='git push --force-with-lease'
alias gpuo='git push --set-upstream origin'
alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'

# pull
alias gl='git pull'
alias glum='git pull upstream master'
alias glum='git pull upstream $(get_default_branch)'
alias gpl='git pull'
alias gpp='git pull && git push'
alias gpr='git pull --rebase'
Expand All @@ -128,9 +129,9 @@ alias grm='git rm'
# rebase
alias grb='git rebase'
alias grbc='git rebase --continue'
alias grm='git rebase master'
alias grmi='git rebase master -i'
alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master
alias grm='git rebase $(get_default_branch)'
alias grmi='git rebase $(get_default_branch) -i'
alias gprom='git fetch origin $(get_default_branch) && git rebase origin/$(get_default_branch) && git update-ref refs/heads/$(get_default_branch) origin/$(get_default_branch)' # Rebase with latest remote

# reset
alias gus='git reset HEAD'
Expand Down Expand Up @@ -174,7 +175,7 @@ alias gsu='git submodule update --init --recursive'
# these aliases requires git v2.23+
alias gsw='git switch'
alias gswc='git switch --create'
alias gswm='git switch master'
alias gswm='git switch $(get_default_branch)'
alias gswt='git switch --track'

# tag
Expand All @@ -196,3 +197,11 @@ esac
function gdv() {
git diff --ignore-all-space "$@" | vim -R -
}

function get_default_branch() {
if git branch | grep -q main; then
echo main
else
echo master
fi
}
24 changes: 7 additions & 17 deletions aliases/available/vim.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@
cite 'about-alias'
about-alias 'vim abbreviations'

VIM=$(command -v vim)
GVIM=$(command -v gvim)
MVIM=$(command -v mvim)
_command_exists vim || return

if [[ -n $VIM ]]; then
alias v='$VIM'
# open the vim help in fullscreen incorporated from
# https://stackoverflow.com/a/4687513
alias vimh='${VIM} -c ":h | only"'
fi
alias v='vim'
# open the vim help in fullscreen incorporated from
# https://stackoverflow.com/a/4687513
alias vimh='vim -c ":h | only"'

# open vim in new tab is taken from
# http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek
case $OSTYPE in
darwin*)
[[ -n $MVIM ]] && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
;;
*)
[[ -n $GVIM ]] && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
;;
esac
_command_exists mvim && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
_command_exists gvim && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
13 changes: 7 additions & 6 deletions bash_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BASH_IT_LOG_PREFIX="core: main: "

# Only set $BASH_IT if it's not already set
if [ -z "$BASH_IT" ]; then
if [ -z "${BASH_IT:-}" ]; then
# Setting $BASH to maintain backwards compatibility
export BASH_IT=$BASH
BASH="$(bash -c 'echo $BASH')"
Expand All @@ -20,12 +20,12 @@ source "${BASH_IT}"/vendor/github.com/erichs/composure/composure.sh
source "${BASH_IT}/lib/log.bash"

# We can only log it now
[ -z "$BASH_IT_OLD_BASH_SETUP" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"
[ -z "${BASH_IT_OLD_BASH_SETUP:-}" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"

# For backwards compatibility, look in old BASH_THEME location
if [ -z "$BASH_IT_THEME" ]; then
if [ -z "${BASH_IT_THEME:-}" ]; then
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
export BASH_IT_THEME="$BASH_THEME"
export BASH_IT_THEME="${BASH_THEME:-}"
unset BASH_THEME
fi

Expand Down Expand Up @@ -114,6 +114,7 @@ for _bash_it_config_file in $CUSTOM; do
if [ -e "${_bash_it_config_file}" ]; then
filename=$(basename "${_bash_it_config_file}")
filename=${filename%*.bash}
# shellcheck disable=SC2034
BASH_IT_LOG_PREFIX="custom: $filename: "
_log_debug "Loading custom file..."
# shellcheck disable=SC1090
Expand All @@ -122,7 +123,7 @@ for _bash_it_config_file in $CUSTOM; do
done

unset _bash_it_config_file
if [[ $PROMPT ]]; then
if [[ -n "${PROMPT:-}" ]]; then
export PS1="\[""$PROMPT""\]"
fi

Expand All @@ -144,7 +145,7 @@ if [ -e "$HOME/.jekyllconfig" ]; then
fi

# BASH_IT_RELOAD_LEGACY is set.
if ! command -v reload &> /dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then
if ! _command_exists reload && [[ -n "${BASH_IT_RELOAD_LEGACY:-}" ]]; then
case $OSTYPE in
darwin*)
alias reload='source ~/.bash_profile'
Expand Down
23 changes: 23 additions & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ completion/available/cargo.completion.bash
completion/available/composer.completion.bash
completion/available/conda.completion.bash
completion/available/consul.completion.bash
completion/available/dart.completion.bash
completion/available/django.completion.bash
completion/available/dmidecode.completion.bash
completion/available/docker-machine.completion.bash
completion/available/docker.completion.bash
completion/available/gcloud.completion.bash
completion/available/gem.completion.bash
completion/available/git.completion.bash
completion/available/github-cli.completion.bash
completion/available/go.completion.bash
completion/available/helm.completion.bash
Expand All @@ -57,6 +59,7 @@ completion/available/jungle.completion.bash
completion/available/knife.completion.bash
completion/available/kontena.completion.bash
completion/available/kubectl.completion.bash
completion/available/laravel.completion.bash
completion/available/lerna.completion.bash
completion/available/minikube.completion.bash
completion/available/ngrok.completion.bash
Expand All @@ -71,19 +74,38 @@ completion/available/rustup.completion.bash
completion/available/sdkman.completion.bash
completion/available/vault.completion.bash
completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash

# libraries
lib/utilities.bash

# plugins
#
plugins/available/alias-completion.plugin.bash
plugins/available/autojump.plugin.bash
plugins/available/base.plugin.bash
plugins/available/basher.plugin.bash
plugins/available/blesh.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/direnv.plugin.bash
plugins/available/docker-machine.plugin.bash
plugins/available/git.plugin.bash
plugins/available/go.plugin.bash
plugins/available/goenv.plugin.bash
plugins/available/history-search.plugin.bash
plugins/available/history-substring-search.plugin.bash
plugins/available/history.plugin.bash
plugins/available/hub.plugin.bash
plugins/available/jump.plugin.bash
plugins/available/less-pretty-cat.plugin.bash
plugins/available/node.plugin.bash
plugins/available/nodenv.plugin.bash
plugins/available/percol.plugin.bash
plugins/available/plenv.plugin.bash
plugins/available/pyenv.plugin.bash
plugins/available/rbenv.plugin.bash
plugins/available/ruby.plugin.bash
plugins/available/textmate.plugin.bash
plugins/available/xterm.plugin.bash

# tests
Expand Down Expand Up @@ -111,6 +133,7 @@ themes/command_duration.theme.bash
themes/easy
themes/modern
themes/powerline
themes/pure
themes/purity

# vendor init files
Expand Down
7 changes: 6 additions & 1 deletion completion/available/awscli.completion.bash
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
[[ -x "$(which aws_completer)" ]] && complete -C "$(which aws_completer)" aws
# shellcheck shell=bash

if _command_exists aws_completer
then
complete -C "$(command -v aws_completer)" aws
fi
18 changes: 8 additions & 10 deletions completion/available/brew.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,26 @@ about-completion "brew completion"
# Load late to make sure `system` completion loads first
# BASH_IT_LOAD_PRIORITY: 375

if [[ "$(uname -s)" != 'Darwin' ]]; then
if [[ "$OSTYPE" != 'darwin'* ]]; then
_log_warning "unsupported operating system - only 'Darwin' is supported"
return 0
fi

# Make sure brew is installed
_command_exists brew || return 0
_bash_it_homebrew_check || return 0

BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}

if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]]; then
if [[ -r "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" ]]; then
# shellcheck disable=1090
source "$BREW_PREFIX"/etc/bash_completion.d/brew
source "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew"

elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]]; then
elif [[ -r "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" ]]; then
# shellcheck disable=1090
source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh
source "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh"

elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]]; then
elif [[ -f "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" ]]; then
# For the git-clone based installation, see here for more info:
# https://github.com/Bash-it/bash-it/issues/1458
# https://docs.brew.sh/Shell-Completion
# shellcheck disable=1090
source "$BREW_PREFIX"/completions/bash/brew
source "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew"
fi
Loading

0 comments on commit d6239cf

Please sign in to comment.