Skip to content

Commit 448f12b

Browse files
authored
Merge branch 'master' into alias/general
2 parents 6a10c55 + dc25be3 commit 448f12b

28 files changed

+986
-283
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 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-24.04, macos-14]
10+
os: [ubuntu-24.04, macos-14]
1111

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

.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

aliases/available/general.aliases.bash

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ 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
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/Downloads' # Go to the Downloads directory
4444

4545
# Shell History
4646
alias h='history'
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
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'
6-
alias got='git '
12+
alias got='git'
713

814
# add
915
alias ga='git add'
@@ -105,6 +111,7 @@ alias gm='git merge'
105111
alias gma='git merge --abort'
106112
alias gmc='git merge --continue'
107113
alias gms='git merge --squash'
114+
alias gmt='git mergetool'
108115

109116
# mv
110117
alias gmv='git mv'

aliases/available/laravel.aliases.bash

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ about-alias 'laravel artisan abbreviations'
33

44
# A list of useful laravel aliases
55

6-
alias laravel='${HOME?}/.composer/vendor/bin/laravel'
6+
if [[ -x "${HOME?}/.config/composer/vendor/bin/laravel" ]]; then
7+
alias laravel='${HOME?}/.config/composer/vendor/bin/laravel'
8+
elif [[ -x "${HOME?}/.composer/vendor/bin/laravel" ]]; then
9+
alias laravel='${HOME?}/.composer/vendor/bin/laravel'
10+
else
11+
return
12+
fi
13+
714
# asset
815
alias a:apub='php artisan asset:publish'
916

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
# shellcheck shell=bash
2-
about-alias 'Aliases for Terraform and Terragrunt'
2+
about-alias 'Aliases for Terraform/OpenTofu and Terragrunt'
33

4-
alias tf='terraform'
5-
alias tfi='tf init'
6-
alias tfv='terraform validate'
7-
alias tfp='terraform plan'
8-
alias tfa='terraform apply'
9-
alias tfd='terraform destroy'
10-
alias tfw='terraform workspace'
4+
if _command_exists terraform; then
5+
alias tf='terraform'
6+
elif _command_exists tofu; then
7+
alias tf='tofu'
8+
fi
9+
10+
if _command_exists tf; then
11+
alias tfa='tf apply'
12+
alias tfp='tf plan'
13+
alias tfd='tf destroy'
14+
alias tfv='tf validate'
15+
alias tfi='tf init'
16+
alias tfo='tf output'
17+
alias tfr='tf refresh'
18+
alias tfw='tf workspace'
19+
alias tfae='tf apply -auto-approve'
20+
alias tfpa='tf plan -out=tfplan && tf apply tfplan'
21+
alias tfpaf='tf plan -out=tfplan && tf apply -auto-approve tfplan'
22+
fi

clean_files.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,19 @@ themes/githelpers.theme.bash
6565
themes/gitline
6666
themes/inretio
6767
themes/lambda
68+
themes/liquidprompt
6869
themes/modern
6970
themes/norbu
7071
themes/oh-my-posh
7172
themes/p4helpers.theme.bash
7273
themes/pete
7374
themes/powerline
75+
themes/powerline-multiline
76+
themes/powerline-naked
7477
themes/pure
7578
themes/purity
7679
themes/rjorgenson
80+
themes/robbyrussell
7781

7882
# vendor init files
7983
#

completion/available/aliases.completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ about-plugin 'Automatic completion of aliases'
99

1010
# Automatically add completion for all aliases to commands having completion functions
1111
function _bash-it-component-completion-callback-on-init-aliases() {
12-
local namespace="alias_completion"
12+
local aliasCommandFunction namespace="alias_completion"
1313
local tmp_file completion_loader alias_name line completions chars
1414
local alias_arg_words new_completion compl_func compl_wrapper alias_defn
1515

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# shellcheck shell=bash
22

3-
# Make sure terraform is installed
4-
_command_exists terraform || return
3+
if _command_exists terraform; then
54

6-
# Don't handle completion if it's already managed
7-
complete -p terraform &> /dev/null && return
5+
# Don't handle completion if it's already managed
6+
complete -p terraform &> /dev/null && return
87

9-
# Terraform completes itself
10-
complete -C terraform terraform
8+
# Terraform completes itself
9+
complete -C terraform terraform
10+
11+
elif _command_exists tofu; then
12+
13+
# Don't handle completion if it's already managed
14+
complete -p tofu &> /dev/null && return
15+
16+
# OpenTofu completes itself
17+
complete -C tofu tofu
18+
19+
fi

lib/helpers.bash

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,6 @@ else
2222
BASH_IT_SED_I_PARAMETERS=('-i' '')
2323
fi
2424

25-
function _command_exists() {
26-
_about 'checks for existence of a command'
27-
_param '1: command to check'
28-
_param '2: (optional) log message to include when command not found'
29-
_example '$ _command_exists ls && echo exists'
30-
_group 'lib'
31-
local msg="${2:-Command '$1' does not exist}"
32-
if type -t "$1" > /dev/null; then
33-
return 0
34-
else
35-
_log_debug "$msg"
36-
return 1
37-
fi
38-
}
39-
40-
function _binary_exists() {
41-
_about 'checks for existence of a binary'
42-
_param '1: binary to check'
43-
_param '2: (optional) log message to include when binary not found'
44-
_example '$ _binary_exists ls && echo exists'
45-
_group 'lib'
46-
local msg="${2:-Binary '$1' does not exist}"
47-
if type -P "$1" > /dev/null; then
48-
return 0
49-
else
50-
_log_debug "$msg"
51-
return 1
52-
fi
53-
}
54-
55-
function _completion_exists() {
56-
_about 'checks for existence of a completion'
57-
_param '1: command to check'
58-
_param '2: (optional) log message to include when completion is found'
59-
_example '$ _completion_exists gh && echo exists'
60-
_group 'lib'
61-
local msg="${2:-Completion for '$1' already exists}"
62-
if complete -p "$1" &> /dev/null; then
63-
_log_debug "$msg"
64-
return 0
65-
else
66-
return 1
67-
fi
68-
}
69-
7025
function _bash_it_homebrew_check() {
7126
if _binary_exists 'brew'; then
7227
# Homebrew is installed
@@ -203,22 +158,6 @@ function bash-it() {
203158
fi
204159
}
205160

206-
function _is_function() {
207-
_about 'sets $? to true if parameter is the name of a function'
208-
_param '1: name of alleged function'
209-
_param '2: (optional) log message to include when function not found'
210-
_group 'lib'
211-
_example '$ _is_function ls && echo exists'
212-
_group 'lib'
213-
local msg="${2:-Function '$1' does not exist}"
214-
if LC_ALL=C type -t "$1" | _bash-it-fgrep -q 'function'; then
215-
return 0
216-
else
217-
_log_debug "$msg"
218-
return 1
219-
fi
220-
}
221-
222161
function _bash-it-aliases() {
223162
_about 'summarizes available bash_it aliases'
224163
_group 'lib'

lib/utilities.bash

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,42 @@ function _bash-it-egrep() {
7878
"${BASH_IT_GREP:-/usr/bin/grep}" -E "$@"
7979
}
8080

81+
function _command_exists() {
82+
: _about 'checks for existence of a command'
83+
: _param '1: command to check'
84+
: _example '$ _command_exists ls && echo exists'
85+
: _group 'lib'
86+
87+
type -t "${1?}" > /dev/null
88+
}
89+
90+
function _binary_exists() {
91+
: _about 'checks for existence of a binary'
92+
: _param '1: binary to check'
93+
: _example '$ _binary_exists ls && echo exists'
94+
: _group 'lib'
95+
96+
type -P "${1?}" > /dev/null
97+
}
98+
99+
function _completion_exists() {
100+
: _about 'checks for existence of a completion'
101+
: _param '1: command to check'
102+
: _example '$ _completion_exists gh && echo exists'
103+
: _group 'lib'
104+
105+
complete -p "${1?}" &> /dev/null
106+
}
107+
108+
function _is_function() {
109+
: _about 'sets $? to true if parameter is the name of a function'
110+
: _param '1: name of alleged function'
111+
: _example '$ _is_function ls && echo exists'
112+
: _group 'lib'
113+
114+
declare -F "${1?}" > /dev/null
115+
}
116+
81117
###########################################################################
82118
# Component-specific functions (component is either an alias, a plugin, or a
83119
# completion).
@@ -181,7 +217,7 @@ function _bash-it-component-item-is-enabled() {
181217
component_type="${1}" item_name="${2?}"
182218
fi
183219

184-
for each_file in "${BASH_IT}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash" \
220+
for each_file in "${BASH_IT?}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash" \
185221
"${BASH_IT}/${component_type}"*/"enabled/${item_name}.${component_type}"*."bash" \
186222
"${BASH_IT}/${component_type}"*/"enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash"; do
187223
if [[ -f "${each_file}" ]]; then

plugins/available/blesh.plugin.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ _bash_it_ble_path=${XDG_DATA_HOME:-$HOME/.local/share}/blesh/ble.sh
1111
if [[ -f $_bash_it_ble_path ]]; then
1212
# shellcheck disable=1090
1313
source "$_bash_it_ble_path" --attach=prompt
14+
if _bash-it-component-item-is-enabled plugin fzf; then
15+
ble-import -d integration/fzf-key-bindings
16+
ble-import -d integration/fzf-completion
17+
fi
1418
else
1519
_log_error "Could not find ble.sh in $_bash_it_ble_path"
1620
_log_error "Please install using the following command:"

plugins/available/fzf.plugin.bash

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
cite about-plugin
66
about-plugin 'load fzf, if you are using it'
77

8-
if [ -r ~/.fzf.bash ]; then
9-
# shellcheck disable=SC1090
10-
source ~/.fzf.bash
11-
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ]; then
12-
# shellcheck disable=SC1091
13-
source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash
14-
fi
8+
if ! _bash-it-component-item-is-enabled plugin blesh; then
9+
if [ -r ~/.fzf.bash ]; then
10+
# shellcheck disable=SC1090
11+
source ~/.fzf.bash
12+
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ]; then
13+
# shellcheck disable=SC1091
14+
source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash
15+
fi
16+
fi # only sources the keybindings and integration if blesh is not integrated already
1517

1618
# No need to continue if the command is not present
1719
_command_exists fzf || return

plugins/available/history-eternal.plugin.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ fi
1010
# truncating the history file early.
1111

1212
# "Numeric values less than zero result in every command being saved on the history list (there is no limit)"
13-
readonly HISTSIZE=-1 2> /dev/null || true
13+
HISTSIZE=-1 2> /dev/null || true
1414

1515
# "Non-numeric values and numeric values less than zero inhibit truncation"
16-
readonly HISTFILESIZE='unlimited' 2> /dev/null || true
16+
HISTFILESIZE='unlimited' 2> /dev/null || true
1717

1818
# Use a custom history file location so history is not truncated
1919
# if the environment ever loses this "eternal" configuration.
2020
HISTDIR="${XDG_STATE_HOME:-${HOME?}/.local/state}/bash"
2121
[[ -d ${HISTDIR?} ]] || mkdir -p "${HISTDIR?}"
22-
readonly HISTFILE="${HISTDIR?}/history" 2> /dev/null || true
22+
HISTFILE="${HISTDIR?}/history" 2> /dev/null || true

0 commit comments

Comments
 (0)