Skip to content

Commit 3790e54

Browse files
authored
Merge branch 'master' into bats-nounset
2 parents 683b9f3 + 6e7b291 commit 3790e54

File tree

213 files changed

+8369
-5667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+8369
-5667
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77
bats-test:
88
strategy:
99
matrix:
10-
os: [ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11]
10+
os: [ubuntu-24.04, macos-14]
1111

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

1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- name: Install greadlink
1717
if: startsWith(runner.os, 'macOS')
1818
run: brew install coreutils
@@ -26,9 +26,9 @@ jobs:
2626
runs-on: ubuntu-latest
2727

2828
steps:
29-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
3030
- name: Set up Python
31-
uses: actions/setup-python@v2
31+
uses: actions/setup-python@v4
3232
with:
3333
python-version: 3.8
3434
- name: Install docs dependencies
@@ -40,20 +40,43 @@ jobs:
4040
runs-on: ubuntu-latest
4141

4242
steps:
43-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v4
4444
- name: Set up Go
45-
uses: actions/setup-go@v2
45+
uses: actions/setup-go@v4
4646
with:
47-
go-version: 1.17
47+
go-version: 1.21.0
4848
- name: Set up Python
49-
uses: actions/setup-python@v2
49+
uses: actions/setup-python@v4
5050
with:
5151
python-version: 3.8
5252
- name: Install shfmt
53-
run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
53+
run: go install mvdan.cc/sh/v3/cmd/shfmt@latest
5454
- name: Install shellcheck
55-
run: brew install shellcheck
55+
env:
56+
scversion: stable # Or latest, vxx, etc
57+
run: |
58+
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv "shellcheck-${scversion}/shellcheck"
59+
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/
60+
shellcheck --version
5661
- name: Install pre-commit
5762
run: python3 -m pip install -r test/lint-requirements.txt
5863
- name: Run lint
5964
run: ./lint_clean_files.sh
65+
66+
lint-differential:
67+
runs-on: ubuntu-latest
68+
69+
permissions:
70+
security-events: write
71+
72+
steps:
73+
- name: Repository checkout
74+
uses: actions/checkout@v4
75+
with:
76+
fetch-depth: 0
77+
78+
- id: ShellCheck
79+
name: Differential ShellCheck
80+
uses: redhat-plumbers-in-action/differential-shellcheck@v5
81+
with:
82+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ tmp/
2222
profiles/*
2323
# apart from the default one
2424
!profiles/default.bash_it
25+
26+
/vendor/github.com/nojhan/liquidprompt

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[submodule "test_lib/bats-core"]
22
path = test_lib/bats-core
33
url = https://github.com/bats-core/bats-core
4-
branch = tags/v1.2.0
4+
branch = tags/v1.9.0
55
[submodule "test_lib/bats-support"]
66
path = test_lib/bats-support
77
url = https://github.com/bats-core/bats-support
88
branch = tags/v0.3.0
99
[submodule "test_lib/bats-assert"]
1010
path = test_lib/bats-assert
1111
url = https://github.com/bats-core/bats-assert
12-
branch = tags/v2.0.0
12+
branch = tags/v2.1.0
1313
[submodule "test_lib/bats-file"]
1414
path = test_lib/bats-file
1515
url = https://github.com/bats-core/bats-file
16-
branch = tags/v0.3.0
16+
branch = tags/v0.4.0

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ repos:
1919
hooks:
2020
- id: git-check # Configure in .gitattributes
2121
- id: shellcheck
22+
files: "\\.(bash)$"
2223
- id: shfmt
2324
- repo: https://github.com/Lucas-C/pre-commit-hooks
2425
rev: v1.1.7
@@ -38,7 +39,7 @@ repos:
3839
name: Check .bash files against bash-it requirements
3940
entry: ./hooks/dot-bash.sh
4041
language: system
41-
files: "\\.ba[ts][sh]$"
42+
files: "\\.bash$"
4243
types: [file]
4344
- id: clean-files-txt
4445
name: Check that clean_files.txt is sorted alphabetically.

aliases/available/dnf.aliases.bash

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# shellcheck shell=bash
22
about-alias 'dnf aliases for fedora 22+ distros'
33

4-
alias dnfl="dnf list" # List packages
5-
alias dnfli="dnf list installed" # List installed packages
6-
alias dnfgl="dnf grouplist" # List package groups
7-
alias dnfmc="dnf makecache" # Generate metadata cache
8-
alias dnfp="dnf info" # Show package information
9-
alias dnfs="dnf search" # Search package
4+
if _command_exists dnf; then
5+
alias dnfp="dnf info" # Show package information
6+
alias dnfl="dnf list" # List packages
7+
alias dnfli="dnf list installed" # List installed packages
8+
alias dnfgl="dnf grouplist" # List package groups
9+
alias dnfmc="dnf makecache" # Generate metadata cache
10+
alias dnfs="dnf search" # Search package
1011

11-
alias dnfu="sudo dnf upgrade" # Upgrade package
12-
alias dnfi="sudo dnf install" # Install package
13-
alias dnfri='sudo dnf reinstall' # Reinstall package
14-
alias dnfgi="sudo dnf groupinstall" # Install package group
15-
alias dnfr="sudo dnf remove" # Remove package
16-
alias dnfgr="sudo dnf groupremove" # Remove package group
17-
alias dnfc="sudo dnf clean all" # Clean cache
12+
alias dnfi="sudo dnf install" # Install package
13+
alias dnfr="sudo dnf remove" # Remove package
14+
alias dnfu="sudo dnf upgrade" # Upgrade package
15+
alias dnfc="sudo dnf clean all" # Clean cache
16+
alias dnfri="sudo dnf reinstall" # Reinstall package
17+
alias dnfgi="sudo dnf groupinstall" # Install package group
18+
alias dnfgr="sudo dnf groupremove" # Remove package group
19+
fi

aliases/available/general.aliases.bash

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434
alias c='clear'
3535
alias cls='clear'
3636

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

4040
alias q='exit'
@@ -50,11 +50,12 @@ alias ipy='ipython'
5050

5151
alias piano='pianobar'
5252

53-
alias ..='cd ..' # Go up one directory
54-
alias cd..='cd ..' # Common misspelling for going up one directory
55-
alias ...='cd ../..' # Go up two directories
56-
alias ....='cd ../../..' # Go up three directories
57-
alias -- -='cd -' # Go back
53+
alias ..='cd ..' # Go up one directory
54+
alias cd..='cd ..' # Common misspelling for going up one directory
55+
alias ...='cd ../..' # Go up two directories
56+
alias ....='cd ../../..' # Go up three directories
57+
alias -- -='cd -' # Go back
58+
alias dow='cd /home/$USER/Downloads' # Go to the Downloads directory
5859

5960
# Shell History
6061
alias h='history'
@@ -68,13 +69,12 @@ fi
6869
alias md='mkdir -p'
6970
alias rd='rmdir'
7071

72+
# Remove
73+
alias rmrf='rm -rf'
74+
7175
# Shorten extract
7276
alias xt='extract'
7377

74-
# sudo editors
75-
alias svim='sudo ${VISUAL:-vim}'
76-
alias snano='sudo nano'
77-
7878
# Display whatever file is regular file or folder
7979
function catt() {
8080
for i in "$@"; do
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# shellcheck shell=bash
2+
cite 'about-alias'
3+
about-alias 'git aliases from oh-my-zsh (incompatible with regular git aliases option)'
4+
5+
if _bash-it-component-item-is-enabled aliases git; then
6+
_log_warning "git-omz aliases are incompatible with regular git aliases"
7+
return 1
8+
fi
9+
10+
# Load after regular git aliases
11+
# BASH_IT_LOAD_PRIORITY: 160
12+
13+
# Setup git version
14+
read -ra git_version_arr <<< "$(git version 2> /dev/null)"
15+
# shellcheck disable=SC2034
16+
git_version="${git_version_arr[2]}"
17+
18+
# Setup is-at-least
19+
function is-at-least {
20+
local expected_version=$1
21+
local actual_version=$2
22+
local versions
23+
24+
printf -v versions '%s\n%s' "$expected_version" "$actual_version"
25+
[[ $versions = "$(sort -V <<< "$versions")" ]]
26+
}
27+
28+
# Setup git_current_branch
29+
function git_current_branch {
30+
_git-branch
31+
}
32+
33+
# shellcheck disable=SC1090
34+
source "${BASH_IT}"/vendor/github.com/ohmyzsh/ohmyzsh/plugins/git/git.plugin.zsh

aliases/available/git.aliases.bash

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
# shellcheck shell=bash
22
about-alias 'common git abbreviations'
33

4+
# We can use this variable to make sure that we don't accidentally clash with git-zsh aliases
5+
if _bash-it-component-item-is-enabled aliases git-omz; then
6+
_log_warning "The aliases from 'git' and from 'git-omz' conflict with each other; please only enable one."
7+
return 1
8+
fi
9+
410
alias g='git'
511
alias get='git'
12+
alias got='git '
613

714
# add
815
alias ga='git add'
916
alias gall='git add -A'
1017
alias gap='git add -p'
18+
alias gav='git add -v'
1119

1220
# branch
1321
alias gb='git branch'
14-
alias gbD='git branch -D'
15-
alias gba='git branch -a'
22+
alias gba='git branch --all'
1623
alias gbd='git branch -d'
17-
alias gbm='git branch -m'
24+
alias gbD='git branch -D'
25+
alias gbl='git branch --list'
26+
alias gbla='git branch --list --all'
27+
alias gblr='git branch --list --remotes'
28+
alias gbm='git branch --move'
29+
alias gbr='git branch --remotes'
1830
alias gbt='git branch --track'
19-
alias gdel='git branch -D'
2031

2132
# for-each-ref
2233
alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396
@@ -27,6 +38,9 @@ alias gca='git commit -v -a'
2738
alias gcaa='git commit -a --amend -C HEAD' # Add uncommitted and unstaged changes to the last commit
2839
alias gcam='git commit -v -am'
2940
alias gcamd='git commit --amend'
41+
alias gc!='git commit -v --amend'
42+
alias gca!='git commit -v -a --amend'
43+
alias gcn!='git commit -v --amend --no-edit'
3044
alias gcm='git commit -v -m'
3145
alias gci='git commit --interactive'
3246
alias gcsam='git commit -S -am'
@@ -74,6 +88,8 @@ alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' #
7488
alias gll='git log --graph --pretty=oneline --abbrev-commit'
7589
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
7690
alias gwc='git whatchanged'
91+
alias ghist='git log --pretty=format:'\''%h %ad | %s%d [%an]'\'' --graph --date=short' # Use it to be fast and without color.
92+
alias gprogress='git log --pretty=format:'\''%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d'\'' --decorate --date=short' #Usually use "git progress" in the file .gitconfig. The new alias from Git friends will be truly welcome.
7793

7894
# ls-files
7995
alias gu='git ls-files . --exclude-standard --others' # Show untracked files
@@ -92,6 +108,9 @@ fi
92108

93109
# merge
94110
alias gm='git merge'
111+
alias gma='git merge --abort'
112+
alias gmc='git merge --continue'
113+
alias gms='git merge --squash'
95114

96115
# mv
97116
alias gmv='git mv'
@@ -102,7 +121,8 @@ alias gpatch='git format-patch -1'
102121
# push
103122
alias gp='git push'
104123
alias gpd='git push --delete'
105-
alias gpf='git push --force'
124+
alias gpf='git push --force-with-lease'
125+
alias gpff='git push --force'
106126
alias gpo='git push origin HEAD'
107127
alias gpom='git push origin $(get_default_branch)'
108128
alias gpu='git push --set-upstream'
@@ -112,6 +132,7 @@ alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
112132

113133
# pull
114134
alias gl='git pull'
135+
alias glp='git pull --prune'
115136
alias glum='git pull upstream $(get_default_branch)'
116137
alias gpl='git pull'
117138
alias gpp='git pull && git push'
@@ -124,17 +145,21 @@ alias grv='git remote -v'
124145

125146
# rm
126147
alias grm='git rm'
148+
alias grmc='git rm --cached' # Removes the file only from the Git repository, but not from the filesystem. This is useful to undo some of the changes you made to a file before you commit it.
127149

128150
# rebase
129151
alias grb='git rebase'
152+
alias grba='git rebase --abort'
130153
alias grbc='git rebase --continue'
131-
alias grm='git rebase $(get_default_branch)'
132-
alias grmi='git rebase $(get_default_branch) -i'
133-
alias grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
154+
alias grbm='git rebase $(get_default_branch)'
155+
alias grbmi='git rebase $(get_default_branch) --interactive'
156+
alias grbma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) --interactive --autosquash'
134157
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
135158

136159
# reset
137-
alias gus='git reset HEAD'
160+
alias gus='git reset HEAD' # read as: 'git unstage'
161+
alias grh='git reset' # equivalent to: git reset HEAD
162+
alias grh!='git reset --hard'
138163
alias gpristine='git reset --hard && git clean -dfx'
139164

140165
# status
@@ -147,6 +172,8 @@ alias gsl='git shortlog -sn'
147172

148173
# show
149174
alias gsh='git show'
175+
alias gshn='git show --name-only'
176+
alias gshns='git show --name-status'
150177

151178
# svn
152179
alias gsd='git svn dcommit'
@@ -199,9 +226,6 @@ function gdv() {
199226
}
200227

201228
function get_default_branch() {
202-
if git branch | grep -q '^. main\s*$'; then
203-
echo main
204-
else
205-
echo master
206-
fi
229+
branch=$(git symbolic-ref refs/remotes/origin/HEAD)
230+
${branch#refs/remotes/origin/}
207231
}
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# shellcheck shell=bash
22
about-alias 'Some aliases for Homebrew'
33

4-
alias bup='brew update && brew upgrade'
5-
alias bout='brew outdated'
6-
alias bin='brew install'
7-
alias brm='brew uninstall'
8-
alias bcl='brew cleanup'
9-
alias bls='brew list'
10-
alias bsr='brew search'
11-
alias binf='brew info'
12-
alias bdr='brew doctor'
13-
alias bed='brew edit'
4+
if _command_exists brew; then
5+
alias bed='brew edit'
6+
alias bls='brew list'
7+
alias bsr='brew search'
8+
alias bdr='brew doctor'
9+
alias bin='brew install'
10+
alias bcl='brew cleanup'
11+
alias brm='brew uninstall'
12+
alias bout='brew outdated'
13+
alias binf='brew info'
14+
alias bup='brew update && brew upgrade'
15+
fi

0 commit comments

Comments
 (0)