Skip to content

Commit 6a10c55

Browse files
authored
Merge branch 'master' into alias/general
2 parents c39673c + 0743ebe commit 6a10c55

File tree

155 files changed

+4758
-4575
lines changed

Some content is hidden

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

155 files changed

+4758
-4575
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
bats-test:
88
strategy:
99
matrix:
10-
os: [ubuntu-20.04, ubuntu-22.04, macos-14, macos-15]
10+
os: [ubuntu-20.04, ubuntu-24.04, macos-14]
1111

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

@@ -62,3 +62,21 @@ jobs:
6262
run: python3 -m pip install -r test/lint-requirements.txt
6363
- name: Run lint
6464
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 }}

.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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ if _command_exists pianobar; then
3535
alias piano='pianobar'
3636
fi
3737

38+
alias ..='cd ..' # Go up one directory
39+
alias cd..='cd ..' # Common misspelling for going up one directory
40+
alias ...='cd ../..' # Go up two directories
41+
alias ....='cd ../../..' # Go up three directories
42+
alias -- -='cd -' # Go back
43+
alias dow='cd /home/$USER/Downloads' # Go to the Downloads directory
44+
3845
# Shell History
3946
alias h='history'
4047

@@ -47,6 +54,9 @@ fi
4754
alias md='mkdir -p'
4855
alias rd='rmdir'
4956

57+
# Remove
58+
alias rmrf='rm -rf'
59+
5060
# Shorten extract
5161
alias xt='extract'
5262

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

clean_files.txt

Lines changed: 12 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
# root directories
1818
#
1919
aliases/
20+
completion/
2021
docs/
2122
hooks/
2223
lib/
24+
plugins/
2325
scripts/
2426
test/
2527

@@ -31,118 +33,6 @@ clean_files.txt
3133
install.sh
3234
lint_clean_files.sh
3335

34-
# completions
35-
#
36-
completion/available/aliases.completion.bash
37-
completion/available/apm.completion.bash
38-
completion/available/awless.completion.bash
39-
completion/available/awscli.completion.bash
40-
completion/available/bash-it.completion.bash
41-
completion/available/brew.completion.bash
42-
completion/available/bundler.completion.bash
43-
completion/available/cargo.completion.bash
44-
completion/available/composer.completion.bash
45-
completion/available/conda.completion.bash
46-
completion/available/consul.completion.bash
47-
completion/available/dart.completion.bash
48-
completion/available/django.completion.bash
49-
completion/available/dmidecode.completion.bash
50-
completion/available/docker-machine.completion.bash
51-
completion/available/docker.completion.bash
52-
completion/available/dotnet.completion.bash
53-
completion/available/export.completion.bash
54-
completion/available/flutter.completion.bash
55-
completion/available/gcloud.completion.bash
56-
completion/available/gem.completion.bash
57-
completion/available/git.completion.bash
58-
completion/available/github-cli.completion.bash
59-
completion/available/go.completion.bash
60-
completion/available/helm.completion.bash
61-
completion/available/jboss5.completion.bash
62-
completion/available/jboss7.completion.bash
63-
completion/available/jungle.completion.bash
64-
completion/available/knife.completion.bash
65-
completion/available/kontena.completion.bash
66-
completion/available/kubectl.completion.bash
67-
completion/available/laravel.completion.bash
68-
completion/available/lerna.completion.bash
69-
completion/available/minikube.completion.bash
70-
completion/available/ngrok.completion.bash
71-
completion/available/notify-send.completion.bash
72-
completion/available/npm.completion.bash
73-
completion/available/packer.completion.bash
74-
completion/available/pip.completion.bash
75-
completion/available/pip3.completion.bash
76-
completion/available/pipenv.completion.bash
77-
completion/available/pipx.completion.bash
78-
completion/available/rustup.completion.bash
79-
completion/available/salt.completion.bash
80-
completion/available/sdkman.completion.bash
81-
completion/available/system.completion.bash
82-
completion/available/vault.completion.bash
83-
completion/available/vuejs.completion.bash
84-
completion/available/wpscan.completion.bash
85-
completion/available/yarn.completion.bash
86-
87-
# plugins
88-
#
89-
plugins/available/alias-completion.plugin.bash
90-
plugins/available/autojump.plugin.bash
91-
plugins/available/base.plugin.bash
92-
plugins/available/basher.plugin.bash
93-
plugins/available/battery.plugin.bash
94-
plugins/available/blesh.plugin.bash
95-
plugins/available/browser.plugin.bash
96-
plugins/available/cmd-returned-notify.plugin.bash
97-
plugins/available/colors.plugin.bash
98-
plugins/available/direnv.plugin.bash
99-
plugins/available/dirs.plugin.bash
100-
plugins/available/docker-compose.plugin.bash
101-
plugins/available/docker-machine.plugin.bash
102-
plugins/available/extract.plugin.bash
103-
plugins/available/gif.plugin.bash
104-
plugins/available/git-subrepo.plugin.bash
105-
plugins/available/git.plugin.bash
106-
plugins/available/go.plugin.bash
107-
plugins/available/goenv.plugin.bash
108-
plugins/available/gradle.plugin.bash
109-
plugins/available/history-eternal.plugin.bash
110-
plugins/available/history-search.plugin.bash
111-
plugins/available/history-substring-search.plugin.bash
112-
plugins/available/history.plugin.bash
113-
plugins/available/hub.plugin.bash
114-
plugins/available/java.plugin.bash
115-
plugins/available/jekyll.plugin.bash
116-
plugins/available/jgitflow.plugin.bash
117-
plugins/available/jump.plugin.bash
118-
plugins/available/latex.plugin.bash
119-
plugins/available/less-pretty-cat.plugin.bash
120-
plugins/available/man.plugin.bash
121-
plugins/available/nginx.plugin.bash
122-
plugins/available/node.plugin.bash
123-
plugins/available/nodenv.plugin.bash
124-
plugins/available/osx-timemachine.plugin.bash
125-
plugins/available/osx.plugin.bash
126-
plugins/available/percol.plugin.bash
127-
plugins/available/plenv.plugin.bash
128-
plugins/available/projects.plugin.bash
129-
plugins/available/proxy.plugin.bash
130-
plugins/available/pyenv.plugin.bash
131-
plugins/available/python.plugin.bash
132-
plugins/available/rbenv.plugin.bash
133-
plugins/available/ruby.plugin.bash
134-
plugins/available/textmate.plugin.bash
135-
plugins/available/todo.plugin.bash
136-
plugins/available/url.plugin.bash
137-
plugins/available/xterm.plugin.bash
138-
plugins/available/zoxide.plugin.bash
139-
140-
# tests
141-
#
142-
test/completion/aliases.completion.bats
143-
test/run
144-
test/test_helper.bash
145-
14636
# themes
14737
#
14838
themes/90210
@@ -160,10 +50,19 @@ themes/brainy
16050
themes/brunton
16151
themes/candy
16252
themes/clean
53+
themes/codeword
54+
themes/cooperkid
55+
themes/cupcake
56+
themes/doubletime
57+
themes/doubletime_multiline
58+
themes/doubletime_multiline_pyonly
59+
themes/dulcie
60+
themes/duru
16361
themes/easy
16462
themes/elixr
16563
themes/essential
16664
themes/githelpers.theme.bash
65+
themes/gitline
16766
themes/inretio
16867
themes/lambda
16968
themes/modern
@@ -174,7 +73,7 @@ themes/pete
17473
themes/powerline
17574
themes/pure
17675
themes/purity
177-
76+
themes/rjorgenson
17877

17978
# vendor init files
18079
#

completion/available/aliases.completion.bash

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,24 @@ function _bash-it-component-completion-callback-on-init-aliases() {
4040
line="${line#alias -- }"
4141
line="${line#alias }"
4242
alias_name="${line%%=*}"
43+
44+
# Skip aliases not added by this script that already have completion functions.
45+
# This allows users to define their own alias completion functions.
46+
# For aliases added by this script, we do want to replace them in case the
47+
# alias getting the completion added has changed.
48+
if complete -p "$alias_name" &> /dev/null; then
49+
# Get the -F argument from the existing completion for this alias.
50+
aliasCommandFunction=$(complete -p "$alias_name" | rev | cut -d " " -f 2 | rev)
51+
# Check if aliasCommandFunction starts with our namespace.
52+
if [[ "$aliasCommandFunction" != "_${namespace}::"* ]]; then
53+
continue
54+
fi
55+
56+
# Remove existing completion. It will be replaced by the new one. We need to
57+
# delete it in case the new alias does not support having completion added.
58+
complete -r "$alias_name"
59+
fi
60+
4361
alias_defn="${line#*=\'}" # alias definition
4462
alias_defn="${alias_defn%\'}"
4563
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
@@ -71,13 +89,22 @@ function _bash-it-component-completion-callback-on-init-aliases() {
7189
fi
7290
new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
7391

74-
# create a wrapper inserting the alias arguments if any
75-
if [[ -n $alias_args ]]; then
76-
compl_func="${new_completion/#* -F /}"
77-
compl_func="${compl_func%% *}"
78-
# avoid recursive call loops by ignoring our own functions
79-
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then
80-
compl_wrapper="_${namespace}::${alias_name}"
92+
compl_func="${new_completion/#* -F /}"
93+
compl_func="${compl_func%% *}"
94+
# avoid recursive call loops by ignoring our own functions
95+
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then
96+
compl_wrapper="_${namespace}::${alias_name}"
97+
98+
if [[ -z $alias_args ]]; then
99+
# Create a wrapper without arguments.
100+
# This allows identifying the completions added by this script on reload.
101+
echo "function $compl_wrapper {
102+
$compl_func \"\$@\"
103+
}" >> "$tmp_file"
104+
else
105+
# Create a wrapper inserting the alias arguments
106+
# The use of printf on alias_arg_words is needed to ensure each element of
107+
# the array is quoted. E.X. (one two three) -> ('one' 'two' 'three')
81108
echo "function $compl_wrapper {
82109
local compl_word=\${2?}
83110
local prec_word=\${3?}
@@ -89,14 +116,14 @@ function _bash-it-component-completion-callback-on-init-aliases() {
89116
prec_word=\${prec_word#* }
90117
fi
91118
(( COMP_CWORD += ${#alias_arg_words[@]} ))
92-
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[*]}\" \"\${COMP_WORDS[@]:1}\")
119+
COMP_WORDS=(\"$alias_cmd\" $(printf "%q " "${alias_arg_words[@]}") \"\${COMP_WORDS[@]:1}\")
93120
(( COMP_POINT -= \${#COMP_LINE} ))
94121
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
95122
(( COMP_POINT += \${#COMP_LINE} ))
96123
\"$compl_func\" \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\"
97124
}" >> "$tmp_file"
98-
new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }"
99125
fi
126+
new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }"
100127
fi
101128

102129
# replace completion trigger by alias

0 commit comments

Comments
 (0)