Skip to content

Commit 2697228

Browse files
authored
Merge branch 'master' into patch-3
2 parents bf81dc3 + 0e0476b commit 2697228

Some content is hidden

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

56 files changed

+1121
-729
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.sh text eol=lf
22
*.bash text eol=lf
3+
*.bats text eol=lf
34

45
# Docs allow trailing whitespaces
56
*.md whitespace=-blank-at-eol

.pre-commit-config.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ repos:
1919
hooks:
2020
- id: git-check # Configure in .gitattributes
2121
- id: shellcheck
22-
exclude: ".bats$"
2322
- id: shfmt
2423
exclude: ".bats$"
2524
- repo: https://github.com/Lucas-C/pre-commit-hooks
@@ -38,10 +37,9 @@ repos:
3837
types: [file]
3938
- id: dot-bash
4039
name: Check .bash files against bash-it requirements
41-
exclude: "test/test_helper.bash"
4240
entry: ./hooks/dot-bash.sh
4341
language: system
44-
files: "\\.bash$"
42+
files: "\\.ba[ts][sh]$"
4543
types: [file]
4644
- id: clean-files-txt
4745
name: Check that clean_files.txt is sorted alphabetically.

aliases/available/git.aliases.bash

+23-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ about-alias 'common git abbreviations'
33

44
alias g='git'
55
alias get='git'
6+
alias got='git '
67

78
# add
89
alias ga='git add'
@@ -31,6 +32,9 @@ alias gca='git commit -v -a'
3132
alias gcaa='git commit -a --amend -C HEAD' # Add uncommitted and unstaged changes to the last commit
3233
alias gcam='git commit -v -am'
3334
alias gcamd='git commit --amend'
35+
alias gc!='git commit -v --amend'
36+
alias gca!='git commit -v -a --amend'
37+
alias gcn!='git commit -v --amend --no-edit'
3438
alias gcm='git commit -v -m'
3539
alias gci='git commit --interactive'
3640
alias gcsam='git commit -S -am'
@@ -78,6 +82,8 @@ alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' #
7882
alias gll='git log --graph --pretty=oneline --abbrev-commit'
7983
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
8084
alias gwc='git whatchanged'
85+
alias ghist='git log --pretty=format:'\''%h %ad | %s%d [%an]'\'' --graph --date=short' # Use it to be fast and without color.
86+
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.
8187

8288
# ls-files
8389
alias gu='git ls-files . --exclude-standard --others' # Show untracked files
@@ -96,6 +102,9 @@ fi
96102

97103
# merge
98104
alias gm='git merge'
105+
alias gma='git merge --abort'
106+
alias gmc='git merge --continue'
107+
alias gms='git merge --squash'
99108

100109
# mv
101110
alias gmv='git mv'
@@ -106,7 +115,8 @@ alias gpatch='git format-patch -1'
106115
# push
107116
alias gp='git push'
108117
alias gpd='git push --delete'
109-
alias gpf='git push --force'
118+
alias gpf='git push --force-with-lease'
119+
alias gpff='git push --force'
110120
alias gpo='git push origin HEAD'
111121
alias gpom='git push origin $(get_default_branch)'
112122
alias gpu='git push --set-upstream'
@@ -116,6 +126,7 @@ alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
116126

117127
# pull
118128
alias gl='git pull'
129+
alias glp='git pull --prune'
119130
alias glum='git pull upstream $(get_default_branch)'
120131
alias gpl='git pull'
121132
alias gpp='git pull && git push'
@@ -128,17 +139,21 @@ alias grv='git remote -v'
128139

129140
# rm
130141
alias grm='git rm'
142+
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.
131143

132144
# rebase
133145
alias grb='git rebase'
146+
alias grba='git rebase --abort'
134147
alias grbc='git rebase --continue'
135148
alias grbm='git rebase $(get_default_branch)'
136-
alias grbmi='git rebase $(get_default_branch) -i'
137-
alias grbma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
149+
alias grbmi='git rebase $(get_default_branch) --interactive'
150+
alias grbma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) --interactive --autosquash'
138151
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
139152

140153
# reset
141-
alias gus='git reset HEAD'
154+
alias gus='git reset HEAD' # read as: 'git unstage'
155+
alias grh='git reset' # equivalent to: git reset HEAD
156+
alias grh!='git reset --hard'
142157
alias gpristine='git reset --hard && git clean -dfx'
143158

144159
# status
@@ -151,6 +166,8 @@ alias gsl='git shortlog -sn'
151166

152167
# show
153168
alias gsh='git show'
169+
alias gshn='git show --name-only'
170+
alias gshns='git show --name-status'
154171

155172
# svn
156173
alias gsd='git svn dcommit'
@@ -203,9 +220,6 @@ function gdv() {
203220
}
204221

205222
function get_default_branch() {
206-
if git branch | grep -q '^. main\s*$'; then
207-
echo main
208-
else
209-
echo master
210-
fi
223+
branch=$(git symbolic-ref refs/remotes/origin/HEAD)
224+
${branch#refs/remotes/origin/}
211225
}

aliases/available/maven.aliases.bash

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@ about-alias 'maven abbreviations'
33

44
alias mci='mvn clean install'
55
alias mi='mvn install'
6-
alias mcp='mvn clean package'
6+
alias mc='mvn clean'
7+
alias mct='mvn clean test'
8+
alias mcc='mvn clean compile'
9+
alias mccnt='mvn clean compile -DskipTests=true'
710
alias mp='mvn package'
11+
alias mcp='mvn clean package'
12+
alias mcpnt='mvn clean package -DskipTests=true'
813
alias mrprep='mvn release:prepare'
914
alias mrperf='mvn release:perform'
1015
alias mrrb='mvn release:rollback'
1116
alias mdep='mvn dependency:tree'
1217
alias mpom='mvn help:effective-pom'
1318
alias mcisk='mci -Dmaven.test.skip=true'
1419
alias mcpsk='mcp -Dmaven.test.skip=true'
20+
21+
# Maven service plugin aliases
22+
alias mspring='mvn spring-boot:run'
23+
alias mjetty='mvn jetty:run'
24+
alias mquark='mvn quarkus:dev'
25+
alias mmicro='mvn mn:run'

clean_files.txt

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
aliases/
2020
docs/
2121
hooks/
22+
lib/
2223
scripts/
24+
test/
2325

2426
# root files
2527
#
@@ -31,6 +33,7 @@ lint_clean_files.sh
3133

3234
# completions
3335
#
36+
completion/available/aliases.completion.bash
3437
completion/available/apm.completion.bash
3538
completion/available/awless.completion.bash
3639
completion/available/awscli.completion.bash
@@ -46,6 +49,7 @@ completion/available/dmidecode.completion.bash
4649
completion/available/docker-machine.completion.bash
4750
completion/available/docker.completion.bash
4851
completion/available/dotnet.completion.bash
52+
completion/available/export.completion.bash
4953
completion/available/flutter.completion.bash
5054
completion/available/gcloud.completion.bash
5155
completion/available/gem.completion.bash
@@ -78,18 +82,6 @@ completion/available/vuejs.completion.bash
7882
completion/available/wpscan.completion.bash
7983
completion/available/yarn.completion.bash
8084

81-
# libraries
82-
lib/appearance.bash
83-
lib/colors.bash
84-
lib/command_duration.bash
85-
lib/helpers.bash
86-
lib/history.bash
87-
lib/log.bash
88-
lib/preexec.bash
89-
lib/preview.bash
90-
lib/search.bash
91-
lib/utilities.bash
92-
9385
# plugins
9486
#
9587
plugins/available/alias-completion.plugin.bash
@@ -98,6 +90,7 @@ plugins/available/base.plugin.bash
9890
plugins/available/basher.plugin.bash
9991
plugins/available/battery.plugin.bash
10092
plugins/available/blesh.plugin.bash
93+
plugins/available/browser.plugin.bash
10194
plugins/available/cmd-returned-notify.plugin.bash
10295
plugins/available/colors.plugin.bash
10396
plugins/available/direnv.plugin.bash
@@ -115,6 +108,7 @@ plugins/available/history.plugin.bash
115108
plugins/available/hub.plugin.bash
116109
plugins/available/java.plugin.bash
117110
plugins/available/jekyll.plugin.bash
111+
plugins/available/jgitflow.plugin.bash
118112
plugins/available/jump.plugin.bash
119113
plugins/available/latex.plugin.bash
120114
plugins/available/less-pretty-cat.plugin.bash
@@ -134,6 +128,7 @@ plugins/available/rbenv.plugin.bash
134128
plugins/available/ruby.plugin.bash
135129
plugins/available/textmate.plugin.bash
136130
plugins/available/todo.plugin.bash
131+
plugins/available/url.plugin.bash
137132
plugins/available/xterm.plugin.bash
138133
plugins/available/zoxide.plugin.bash
139134

@@ -159,9 +154,13 @@ themes/bobby-python
159154
themes/brainy
160155
themes/brunton
161156
themes/candy
157+
themes/clean
162158
themes/easy
159+
themes/elixr
163160
themes/essential
164161
themes/githelpers.theme.bash
162+
themes/inretio
163+
themes/lambda
165164
themes/modern
166165
themes/norbu
167166
themes/oh-my-posh
@@ -171,6 +170,7 @@ themes/powerline
171170
themes/pure
172171
themes/purity
173172

173+
174174
# vendor init files
175175
#
176176
vendor/.gitattributes

completion/available/aliases.completion.bash

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function _bash-it-component-completion-callback-on-init-aliases() {
2020
completions=("${completions[@]##complete -* * -}") # strip all but last option plus trigger(s)
2121
completions=("${completions[@]#complete -}") # strip anything missed
2222
completions=("${completions[@]#? * }") # strip last option and arg, leaving only trigger(s)
23-
completions=("${completions[@]#? }") # strip anything missed
23+
completions=("${completions[@]#? }") # strip anything missed
2424
#TODO: this will fail on some completions...
2525

2626
# create temporary file for wrapper functions and completions
@@ -40,10 +40,10 @@ function _bash-it-component-completion-callback-on-init-aliases() {
4040
line="${line#alias -- }"
4141
line="${line#alias }"
4242
alias_name="${line%%=*}"
43-
alias_defn="${line#*=\'}" # alias definition
43+
alias_defn="${line#*=\'}" # alias definition
4444
alias_defn="${alias_defn%\'}"
4545
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
46-
if [[ ${alias_defn} == ${alias_cmd} ]]; then
46+
if [[ ${alias_defn} == "${alias_cmd}" ]]; then
4747
alias_args=''
4848
else
4949
alias_args="${alias_defn#*[[:space:]]}" # everything after first word
@@ -89,7 +89,7 @@ function _bash-it-component-completion-callback-on-init-aliases() {
8989
prec_word=\${prec_word#* }
9090
fi
9191
(( COMP_CWORD += ${#alias_arg_words[@]} ))
92-
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[@]}\" \"\${COMP_WORDS[@]:1}\")
92+
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[*]}\" \"\${COMP_WORDS[@]:1}\")
9393
(( COMP_POINT -= \${#COMP_LINE} ))
9494
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
9595
(( COMP_POINT += \${#COMP_LINE} ))
+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
complete -o nospace -S = -W '$(printenv | awk -F= "{print \$1}")' export
1+
# shellcheck shell=bash
2+
3+
complete -o nospace -S = -W "$(printenv | awk -F= "{print \$1}")" export

docs/themes-list/index.rst

+15
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,21 @@ Envy
221221

222222
----
223223

224+
Inretio
225+
^^^^^^^
226+
227+
228+
.. image:: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-black.png
229+
:target: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-black.png
230+
:alt: Inretio theme in dark color scheme
231+
232+
233+
.. image:: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-white.png
234+
:target: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-white.png
235+
:alt: Inretio theme in light color scheme
236+
237+
----
238+
224239
Iterate
225240
^^^^^^^
226241

docs/themes-list/inretio.rst

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. _inretio:
2+
3+
Inretio Theme
4+
=============
5+
6+
Simple theme showing date and time, username and hostname, current folder, Git details and as a bonus - virtual environment along with Python version available in it.
7+
8+
Inspired by existing themes:
9+
- metal
10+
- bobby
11+
12+
Examples
13+
--------
14+
15+
In Git-tracked folder:
16+
17+
.. code-block:: bash
18+
19+
┌──[2024-03-20 12:05:07] 🐧 gytis 💻 gytis-legion 📂 bash-it on 🌵 theme-inretio ⌀1 ✗
20+
> ls
21+
aliases clean_files.txt custom hooks lib lint_clean_files.sh profiles template test_lib uninstall.sh
22+
bash_it.sh completion docs install.sh LICENSE plugins scripts test themes vendor
23+
24+
25+
In Python virtual environment:
26+
27+
.. code-block:: bash
28+
29+
┌──[2024-03-20 12:07:32] 🐧 gytis 💻 gytis-legion 🐍 3.12.2 on [general] 📂 general
30+
> ls
31+
bin include lib lib64 pyvenv.cfg share

docs/themes-list/powerline-base.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
8181
* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv``
8282
and ``conda`` supported)
8383
* ``ruby`` - Current ruby version if using ``rvm``
84-
* ``node`` - Current node version (only ``nvm`` is supported)
84+
* ``node`` - Current node version (``nvm`` is the default strategy; set ``NODE_VERSION_STRATEGY`` to ``node`` to use ``node --version``)
8585
* ``scm`` - Version control information, ``git``
8686
* ``terraform`` - Current terraform workspace
8787
* ``user_info`` - Current user

hooks/dot-bash.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ for file in "$@"; do
1212
# Confirm expected schellcheck header
1313
#
1414
LINE1="$(head -n 1 "${file}")"
15-
if [[ "${LINE1}" != "# shellcheck shell=bash" ]]; then
15+
SCSH="${file##*.}"
16+
if [[ "${LINE1}" != "# shellcheck shell=${SCSH}" ]]; then
1617
echo "Bash include file \`${file}\` has bad/missing shellcheck header"
1718
exit_code=1
1819
fi

lib/command_duration.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function _dynamic_clock_icon {
2626
local clock_hand
2727
# clock hand value is between 90 and 9b in hexadecimal.
2828
# so between 144 and 155 in base 10.
29-
printf -v clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144))
29+
printf -v clock_hand '%x' $((((${1:-${SECONDS}} - 1) % 12) + 144))
3030
printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand"
3131
}
3232

lint_clean_files.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mapfile -t FILES < <(
1010
cat clean_files.txt \
1111
| grep -E -v '^\s*$' \
1212
| grep -E -v '^\s*#' \
13-
| xargs -n1 -I{} find "{}" -type f
13+
| xargs -I{} find "{}" -type f
1414
)
1515

1616
# We clear the BASH_IT variable to help the shellcheck checker

0 commit comments

Comments
 (0)