Skip to content

Commit c5be0e7

Browse files
authored
Merge branch 'master' into bats-precommit
2 parents 984c0c6 + 6949272 commit c5be0e7

25 files changed

+363
-56
lines changed

aliases/available/git.aliases.bash

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

8389
# ls-files
8490
alias gu='git ls-files . --exclude-standard --others' # Show untracked files
@@ -110,7 +116,8 @@ alias gpatch='git format-patch -1'
110116
# push
111117
alias gp='git push'
112118
alias gpd='git push --delete'
113-
alias gpf='git push --force'
119+
alias gpf='git push --force-with-lease'
120+
alias gpff='git push --force'
114121
alias gpo='git push origin HEAD'
115122
alias gpom='git push origin $(get_default_branch)'
116123
alias gpu='git push --set-upstream'
@@ -120,6 +127,7 @@ alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
120127

121128
# pull
122129
alias gl='git pull'
130+
alias glp='git pull --prune'
123131
alias glum='git pull upstream $(get_default_branch)'
124132
alias gpl='git pull'
125133
alias gpp='git pull && git push'
@@ -132,6 +140,7 @@ alias grv='git remote -v'
132140

133141
# rm
134142
alias grm='git rm'
143+
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.
135144

136145
# rebase
137146
alias grb='git rebase'
@@ -144,7 +153,9 @@ alias grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosqu
144153
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
145154

146155
# reset
147-
alias gus='git reset HEAD'
156+
alias gus='git reset HEAD' # read as: 'git unstage'
157+
alias grh='git reset' # equivalent to: git reset HEAD
158+
alias grh!='git reset --hard'
148159
alias gpristine='git reset --hard && git clean -dfx'
149160

150161
# status
@@ -211,9 +222,6 @@ function gdv() {
211222
}
212223

213224
function get_default_branch() {
214-
if git branch | grep -q '^. main\s*$'; then
215-
echo main
216-
else
217-
echo master
218-
fi
225+
branch=$(git symbolic-ref refs/remotes/origin/HEAD)
226+
${branch#refs/remotes/origin/}
219227
}

aliases/available/maven.aliases.bash

Lines changed: 12 additions & 1 deletion
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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
aliases/
2020
docs/
2121
hooks/
22+
lib/
2223
scripts/
2324
test/
2425

@@ -32,6 +33,7 @@ lint_clean_files.sh
3233

3334
# completions
3435
#
36+
completion/available/aliases.completion.bash
3537
completion/available/apm.completion.bash
3638
completion/available/awless.completion.bash
3739
completion/available/awscli.completion.bash
@@ -47,6 +49,7 @@ completion/available/dmidecode.completion.bash
4749
completion/available/docker-machine.completion.bash
4850
completion/available/docker.completion.bash
4951
completion/available/dotnet.completion.bash
52+
completion/available/export.completion.bash
5053
completion/available/flutter.completion.bash
5154
completion/available/gcloud.completion.bash
5255
completion/available/gem.completion.bash
@@ -79,18 +82,6 @@ completion/available/vuejs.completion.bash
7982
completion/available/wpscan.completion.bash
8083
completion/available/yarn.completion.bash
8184

82-
# libraries
83-
lib/appearance.bash
84-
lib/colors.bash
85-
lib/command_duration.bash
86-
lib/helpers.bash
87-
lib/history.bash
88-
lib/log.bash
89-
lib/preexec.bash
90-
lib/preview.bash
91-
lib/search.bash
92-
lib/utilities.bash
93-
9485
# plugins
9586
#
9687
plugins/available/alias-completion.plugin.bash
@@ -135,6 +126,7 @@ plugins/available/rbenv.plugin.bash
135126
plugins/available/ruby.plugin.bash
136127
plugins/available/textmate.plugin.bash
137128
plugins/available/todo.plugin.bash
129+
plugins/available/url.plugin.bash
138130
plugins/available/xterm.plugin.bash
139131
plugins/available/zoxide.plugin.bash
140132

@@ -160,9 +152,13 @@ themes/bobby-python
160152
themes/brainy
161153
themes/brunton
162154
themes/candy
155+
themes/clean
163156
themes/easy
157+
themes/elixr
164158
themes/essential
165159
themes/githelpers.theme.bash
160+
themes/inretio
161+
themes/lambda
166162
themes/modern
167163
themes/norbu
168164
themes/oh-my-posh
@@ -172,6 +168,7 @@ themes/powerline
172168
themes/pure
173169
themes/purity
174170

171+
175172
# vendor init files
176173
#
177174
vendor/.gitattributes

completion/available/aliases.completion.bash

Lines changed: 4 additions & 4 deletions
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} ))
Lines changed: 3 additions & 1 deletion
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

Lines changed: 15 additions & 0 deletions
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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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
32+

docs/themes-list/powerline-base.rst

Lines changed: 1 addition & 1 deletion
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

lib/command_duration.bash

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

plugins/available/gif.plugin.bash

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function v2gif() {
6464
fi
6565

6666
# Parse the options
67-
args=$("$getopt" -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@") || {
67+
args=$("$getopt" -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l help -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@") || {
6868
echo 'Terminating...' >&2
6969
return 2
7070
}
@@ -82,6 +82,7 @@ function v2gif() {
8282
local fps=""
8383
local make_webm=""
8484
local alert=5000
85+
local printhelp=""
8586
while [[ $# -ge 1 ]]; do
8687
case "$1" in
8788
--)
@@ -94,6 +95,11 @@ function v2gif() {
9495
opt_del_after="true"
9596
shift
9697
;;
98+
--help)
99+
# Print Help
100+
printhelp="true"
101+
shift
102+
;;
97103
-h | --high)
98104
#High Quality, use gifski
99105
gifski="$(type -p gifski)"
@@ -141,7 +147,7 @@ function v2gif() {
141147
esac
142148
done
143149

144-
if [[ -z "$*" ]]; then
150+
if [[ -z "$*" || "$printhelp" ]]; then
145151
echo "$(tput setaf 1)No input files given. Example: v2gif file [file...] [-w <max width (pixels)>] [-l <lossy level>] $(tput sgr 0)"
146152
echo "-d/--del/--delete Delete original vid if done suceessfully (and file not over the size limit)"
147153
echo "-h/--high High Quality - use Gifski instead of gifsicle"

plugins/available/nvm.plugin.bash

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ cite about-plugin
99
about-plugin 'node version manager configuration'
1010

1111
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
12+
13+
# first check if NVM is managed by brew
14+
NVM_BREW_PREFIX=""
15+
if _bash_it_homebrew_check
16+
then
17+
NVM_BREW_PREFIX=$(brew --prefix nvm 2>/dev/null)
18+
fi
19+
1220
# This loads nvm
13-
if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh" ]]
21+
if [[ -n "$NVM_BREW_PREFIX" && -s "${NVM_BREW_PREFIX}/nvm.sh" ]]
1422
then
15-
source "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh"
23+
source "${NVM_BREW_PREFIX}/nvm.sh"
1624
else
1725
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
1826
fi

plugins/available/url.plugin.bash

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# shellcheck shell=bash
2+
cite about-plugin
3+
about-plugin 'Basic url handling and manipulation functions'
4+
5+
function slugify() {
6+
about 'takes the text and transform to slug url, also supports formats like (html,link,rst,md)'
7+
group 'url'
8+
param "1: Text to transform (optional)"
9+
param "2: Output format (html,rst,link,md). Omit or pass any text to return only output"
10+
11+
local TXT=$1
12+
local OUTPUT=$2
13+
local SLUG
14+
15+
if [[ -z $TXT ]]; then
16+
read -rp "Enter the valid string: " TXT
17+
fi
18+
19+
# Pass 1 - Clean the url
20+
# Credits: https://stackoverflow.com/a/20007549/10362396
21+
SLUG=$(echo -n "$TXT" | tr -cd ' [:alnum:]._-' | tr -s ' ')
22+
23+
# Pass 2 - Transformation
24+
SLUG=$(echo -n "$SLUG" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
25+
26+
case "$OUTPUT" in
27+
html | htm)
28+
echo "<a href=\"#$SLUG\">$TXT</a>"
29+
;;
30+
href | link)
31+
echo "#$SLUG"
32+
;;
33+
md)
34+
echo "[$TXT](#$SLUG)"
35+
;;
36+
rst)
37+
echo "\`$TXT <#$SLUG>\`_"
38+
;;
39+
40+
*)
41+
echo "$SLUG"
42+
;;
43+
esac
44+
45+
}

0 commit comments

Comments
 (0)