Skip to content

Commit

Permalink
Merge branch 'master' into bats-precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
seefood authored Nov 6, 2024
2 parents 810c52f + 998e1d6 commit 984c0c6
Show file tree
Hide file tree
Showing 54 changed files with 1,622 additions and 162 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
bats-test:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11]
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-11]

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

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install greadlink
if: startsWith(runner.os, 'macOS')
run: brew install coreutils
Expand All @@ -26,9 +26,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install docs dependencies
Expand All @@ -40,19 +40,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: 1.21.0
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install shfmt
run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
run: go install mvdan.cc/sh/v3/cmd/shfmt@latest
- name: Install shellcheck
run: brew install shellcheck
env:
scversion: stable # Or latest, vxx, etc
run: |
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv "shellcheck-${scversion}/shellcheck"
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/
shellcheck --version
- name: Install pre-commit
run: python3 -m pip install -r test/lint-requirements.txt
- name: Run lint
Expand Down
6 changes: 1 addition & 5 deletions aliases/available/general.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi
alias c='clear'
alias cls='clear'

alias edit='${EDITOR:-${ALTERNATE_EDITOR?}}'
alias edit='${EDITOR:-${ALTERNATE_EDITOR:-nano}}'
alias pager='${PAGER:=less}'

alias q='exit'
Expand Down Expand Up @@ -71,10 +71,6 @@ alias rd='rmdir'
# Shorten extract
alias xt='extract'

# sudo editors
alias svim='sudo ${VISUAL:-vim}'
alias snano='sudo nano'

# Display whatever file is regular file or folder
function catt() {
for i in "$@"; do
Expand Down
18 changes: 15 additions & 3 deletions aliases/available/git.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ alias get='git'
alias ga='git add'
alias gall='git add -A'
alias gap='git add -p'
alias gav='git add -v'

# branch
alias gb='git branch'
alias gbD='git branch -D'
alias gba='git branch -a'
alias gba='git branch --all'
alias gbd='git branch -d'
alias gbm='git branch -m'
alias gbD='git branch -D'
alias gbl='git branch --list'
alias gbla='git branch --list --all'
alias gblr='git branch --list --remotes'
alias gbm='git branch --move'
alias gbr='git branch --remotes'
alias gbt='git branch --track'
alias gdel='git branch -D'

Expand Down Expand Up @@ -92,6 +97,9 @@ fi

# merge
alias gm='git merge'
alias gma='git merge --abort'
alias gmc='git merge --continue'
alias gms='git merge --squash'

# mv
alias gmv='git mv'
Expand Down Expand Up @@ -127,7 +135,9 @@ alias grm='git rm'

# rebase
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbi='git rebase --interactive'
alias grm='git rebase $(get_default_branch)'
alias grmi='git rebase $(get_default_branch) -i'
alias grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
Expand All @@ -147,6 +157,8 @@ alias gsl='git shortlog -sn'

# show
alias gsh='git show'
alias gshn='git show --name-only'
alias gshns='git show --name-status'

# svn
alias gsd='git svn dcommit'
Expand Down
30 changes: 13 additions & 17 deletions aliases/available/kubectl.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# shellcheck shell=bash
about-alias 'kubectl aliases'

function _set_pkg_aliases() {
if _command_exists kubectl; then
alias kc='kubectl'
alias kcgp='kubectl get pods'
alias kcgd='kubectl get deployments'
alias kcgn='kubectl get nodes'
alias kcdp='kubectl describe pod'
alias kcdd='kubectl describe deployment'
alias kcdn='kubectl describe node'
alias kcgpan='kubectl get pods --all-namespaces'
alias kcgdan='kubectl get deployments --all-namespaces'
# launches a disposable netshoot pod in the k8s cluster
alias kcnetshoot='kubectl run netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
fi
}

_set_pkg_aliases
if _command_exists kubectl; then
alias kc='kubectl'
alias kcgp='kubectl get pods'
alias kcgd='kubectl get deployments'
alias kcgn='kubectl get nodes'
alias kcdp='kubectl describe pod'
alias kcdd='kubectl describe deployment'
alias kcdn='kubectl describe node'
alias kcgpan='kubectl get pods --all-namespaces'
alias kcgdan='kubectl get deployments --all-namespaces'
# launches a disposable netshoot pod in the k8s cluster
alias kcnetshoot='kubectl run netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
fi
1 change: 1 addition & 0 deletions aliases/available/osx.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ alias safari='open -a safari'
alias firefox='open -a firefox'
alias chrome='open -a "Google Chrome"'
alias chromium='open -a chromium'
alias brave='open -a "Brave Browser"'
alias dashcode='open -a dashcode'
alias f='open -a Finder '
alias fh='open -a Finder .'
Expand Down
2 changes: 2 additions & 0 deletions aliases/available/terraform.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
about-alias 'Aliases for Terraform and Terragrunt'

alias tf='terraform'
alias tfi='tf init'
alias tfv='terraform validate'
alias tfp='terraform plan'
alias tfa='terraform apply'
alias tfd='terraform destroy'
alias tfw='terraform workspace'
10 changes: 10 additions & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ lint_clean_files.sh
#
completion/available/apm.completion.bash
completion/available/awless.completion.bash
completion/available/awscli.completion.bash
completion/available/bash-it.completion.bash
completion/available/brew.completion.bash
completion/available/cargo.completion.bash
Expand All @@ -46,6 +47,7 @@ completion/available/dmidecode.completion.bash
completion/available/docker-machine.completion.bash
completion/available/docker.completion.bash
completion/available/dotnet.completion.bash
completion/available/flutter.completion.bash
completion/available/gcloud.completion.bash
completion/available/gem.completion.bash
completion/available/git.completion.bash
Expand Down Expand Up @@ -75,6 +77,7 @@ completion/available/system.completion.bash
completion/available/vault.completion.bash
completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash
completion/available/yarn.completion.bash

# libraries
lib/appearance.bash
Expand Down Expand Up @@ -135,6 +138,12 @@ plugins/available/todo.plugin.bash
plugins/available/xterm.plugin.bash
plugins/available/zoxide.plugin.bash

# tests
#
test/completion/aliases.completion.bats
test/run
test/test_helper.bash

# themes
#
themes/90210
Expand All @@ -156,6 +165,7 @@ themes/essential
themes/githelpers.theme.bash
themes/modern
themes/norbu
themes/oh-my-posh
themes/p4helpers.theme.bash
themes/pete
themes/powerline
Expand Down
2 changes: 1 addition & 1 deletion completion/available/aliases.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function _bash-it-component-completion-callback-on-init-aliases() {
fi

# skip aliases to pipes, boolean control structures and other command lists
chars='\|\&\;\)\(\n\<\>'
chars=$'|&;()<>\n'
if [[ "${alias_defn}" =~ [$chars] ]]; then
continue
fi
Expand Down
3 changes: 1 addition & 2 deletions completion/available/awscli.completion.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# shellcheck shell=bash

if _command_exists aws_completer
then
if _command_exists aws_completer; then
complete -C "$(command -v aws_completer)" aws
fi
6 changes: 3 additions & 3 deletions completion/available/brew.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ fi
_bash_it_homebrew_check || return 0

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

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

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
# shellcheck disable=1090,1091
source "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew"
fi
6 changes: 3 additions & 3 deletions completion/available/fabric.completion.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
#
# Bash completion support for Fabric (http://fabfile.org/)
#
Expand Down Expand Up @@ -91,7 +91,7 @@ function __fab_completion() {
-*)
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
export __FAB_COMPLETION_LONG_OPT=$(
fab --help | egrep -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
fi
opts="${__FAB_COMPLETION_LONG_OPT}"
;;
Expand All @@ -101,7 +101,7 @@ function __fab_completion() {
# -*)
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
# export __FAB_COMPLETION_SHORT_OPT=$(
# fab --help | egrep -o "^ +\-[A-Za-z_\]" | sort -u)
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
# fi
# opts="${__FAB_COMPLETION_SHORT_OPT}"
# ;;
Expand Down
4 changes: 2 additions & 2 deletions completion/available/flutter.completion.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/bash
# shellcheck shell=bash

if _command_exists flutter; then
eval "$(flutter bash-completion)"
eval "$(flutter bash-completion)"
fi
4 changes: 3 additions & 1 deletion completion/available/gradle.completion.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# shellcheck shell=bash

# Copyright (c) 2017 Eric Wendelin

# Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down Expand Up @@ -66,7 +68,7 @@ __gradle-generate-script-cache() {

if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
# Cache all Gradle scripts
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern")
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern")
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
fi
}
Expand Down
4 changes: 3 additions & 1 deletion completion/available/makefile.completion.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# shellcheck shell=bash

# Bash completion for Makefile
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048

Expand All @@ -17,7 +19,7 @@ _makecomplete() {
for f in "${files[@]}" ; do
while IFS='' read -r line ; do
targets+=("$line")
done < <(grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
done < <(grep -E -o '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
done

[ "${#targets[@]}" -eq 0 ] && return 0
Expand Down
4 changes: 2 additions & 2 deletions completion/available/projects.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _is_function _rl_enabled ||
_pj() {
_is_function _init_completion || return
_is_function _rl_enabled || return
[ -n "$PROJECT_PATHS" ] || return
[ -n "$BASH_IT_PROJECT_PATHS" ] || return
shift
[ "$1" == "open" ] && shift

Expand All @@ -21,7 +21,7 @@ _pj() {
local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)

for i in ${PROJECT_PATHS//:/$'\n'}; do
for i in ${BASH_IT_PROJECT_PATHS//:/$'\n'}; do
# create an array of matched subdirs
k="${#COMPREPLY[@]}"
for j in $( compgen -d $i/$cur ); do
Expand Down
5 changes: 5 additions & 0 deletions completion/available/yarn.completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# shellcheck shell=bash
about-completion "yarn cli completions"

# shellcheck disable=SC1090 source=../../vendor/github.com/dsifford/yarn-completion/yarn
source "${BASH_IT}/vendor/github.com/dsifford/yarn-completion/yarn"
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
![Docs Status](https://readthedocs.org/projects/bash-it/badge/)
![License](https://img.shields.io/github/license/Bash-it/bash-it)
![shell](https://img.shields.io/badge/Shell-Bash-blue)
[![Join the chat at https://web.libera.chat/?channel=#bash-it](https://img.shields.io/badge/chat-on%20Libera.Chat-brightgreen.svg)](https://web.libera.chat/?channel=#bash-it)

**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
Expand Down
5 changes: 1 addition & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'Bash-it'
Expand All @@ -24,7 +23,6 @@
# The full version, including alpha/beta/rc tags
release = ''


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand All @@ -41,8 +39,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', "venv"]

# -- Options for HTML output -------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ The following libraries are used to help with the tests:


* Test Framework: https://github.com/bats-core/bats-core
* Support library for Bats-Assert: https://github.com/ztombol/bats-support
* General ``assert`` functions: https://github.com/ztombol/bats-assert
* File ``assert`` functions: https://github.com/ztombol/bats-file
* Support library for Bats-Assert: https://github.com/bats-core/bats-support
* General ``assert`` functions: https://github.com/bats-core/bats-assert
* File ``assert`` functions: https://github.com/bats-core/bats-file

When verifying test results, please try to use the ``assert`` functions found in these libraries.

Expand Down
Loading

0 comments on commit 984c0c6

Please sign in to comment.