Skip to content

Commit

Permalink
Merge branch 'master' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
seefood authored Nov 7, 2024
2 parents bf81dc3 + 0e0476b commit 2697228
Show file tree
Hide file tree
Showing 56 changed files with 1,121 additions and 729 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.sh text eol=lf
*.bash text eol=lf
*.bats text eol=lf

# Docs allow trailing whitespaces
*.md whitespace=-blank-at-eol
Expand Down
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ repos:
hooks:
- id: git-check # Configure in .gitattributes
- id: shellcheck
exclude: ".bats$"
- id: shfmt
exclude: ".bats$"
- repo: https://github.com/Lucas-C/pre-commit-hooks
Expand All @@ -38,10 +37,9 @@ repos:
types: [file]
- id: dot-bash
name: Check .bash files against bash-it requirements
exclude: "test/test_helper.bash"
entry: ./hooks/dot-bash.sh
language: system
files: "\\.bash$"
files: "\\.ba[ts][sh]$"
types: [file]
- id: clean-files-txt
name: Check that clean_files.txt is sorted alphabetically.
Expand Down
32 changes: 23 additions & 9 deletions aliases/available/git.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ about-alias 'common git abbreviations'

alias g='git'
alias get='git'
alias got='git '

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

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

# merge
alias gm='git merge'
alias gma='git merge --abort'
alias gmc='git merge --continue'
alias gms='git merge --squash'

# mv
alias gmv='git mv'
Expand All @@ -106,7 +115,8 @@ alias gpatch='git format-patch -1'
# push
alias gp='git push'
alias gpd='git push --delete'
alias gpf='git push --force'
alias gpf='git push --force-with-lease'
alias gpff='git push --force'
alias gpo='git push origin HEAD'
alias gpom='git push origin $(get_default_branch)'
alias gpu='git push --set-upstream'
Expand All @@ -116,6 +126,7 @@ alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'

# pull
alias gl='git pull'
alias glp='git pull --prune'
alias glum='git pull upstream $(get_default_branch)'
alias gpl='git pull'
alias gpp='git pull && git push'
Expand All @@ -128,17 +139,21 @@ alias grv='git remote -v'

# rm
alias grm='git rm'
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.

# rebase
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbm='git rebase $(get_default_branch)'
alias grbmi='git rebase $(get_default_branch) -i'
alias grbma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
alias grbmi='git rebase $(get_default_branch) --interactive'
alias grbma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) --interactive --autosquash'
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

# reset
alias gus='git reset HEAD'
alias gus='git reset HEAD' # read as: 'git unstage'
alias grh='git reset' # equivalent to: git reset HEAD
alias grh!='git reset --hard'
alias gpristine='git reset --hard && git clean -dfx'

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

# show
alias gsh='git show'
alias gshn='git show --name-only'
alias gshns='git show --name-status'

# svn
alias gsd='git svn dcommit'
Expand Down Expand Up @@ -203,9 +220,6 @@ function gdv() {
}

function get_default_branch() {
if git branch | grep -q '^. main\s*$'; then
echo main
else
echo master
fi
branch=$(git symbolic-ref refs/remotes/origin/HEAD)
${branch#refs/remotes/origin/}
}
13 changes: 12 additions & 1 deletion aliases/available/maven.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@ about-alias 'maven abbreviations'

alias mci='mvn clean install'
alias mi='mvn install'
alias mcp='mvn clean package'
alias mc='mvn clean'
alias mct='mvn clean test'
alias mcc='mvn clean compile'
alias mccnt='mvn clean compile -DskipTests=true'
alias mp='mvn package'
alias mcp='mvn clean package'
alias mcpnt='mvn clean package -DskipTests=true'
alias mrprep='mvn release:prepare'
alias mrperf='mvn release:perform'
alias mrrb='mvn release:rollback'
alias mdep='mvn dependency:tree'
alias mpom='mvn help:effective-pom'
alias mcisk='mci -Dmaven.test.skip=true'
alias mcpsk='mcp -Dmaven.test.skip=true'

# Maven service plugin aliases
alias mspring='mvn spring-boot:run'
alias mjetty='mvn jetty:run'
alias mquark='mvn quarkus:dev'
alias mmicro='mvn mn:run'
24 changes: 12 additions & 12 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
aliases/
docs/
hooks/
lib/
scripts/
test/

# root files
#
Expand All @@ -31,6 +33,7 @@ lint_clean_files.sh

# completions
#
completion/available/aliases.completion.bash
completion/available/apm.completion.bash
completion/available/awless.completion.bash
completion/available/awscli.completion.bash
Expand All @@ -46,6 +49,7 @@ completion/available/dmidecode.completion.bash
completion/available/docker-machine.completion.bash
completion/available/docker.completion.bash
completion/available/dotnet.completion.bash
completion/available/export.completion.bash
completion/available/flutter.completion.bash
completion/available/gcloud.completion.bash
completion/available/gem.completion.bash
Expand Down Expand Up @@ -78,18 +82,6 @@ completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash
completion/available/yarn.completion.bash

# libraries
lib/appearance.bash
lib/colors.bash
lib/command_duration.bash
lib/helpers.bash
lib/history.bash
lib/log.bash
lib/preexec.bash
lib/preview.bash
lib/search.bash
lib/utilities.bash

# plugins
#
plugins/available/alias-completion.plugin.bash
Expand All @@ -98,6 +90,7 @@ plugins/available/base.plugin.bash
plugins/available/basher.plugin.bash
plugins/available/battery.plugin.bash
plugins/available/blesh.plugin.bash
plugins/available/browser.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/colors.plugin.bash
plugins/available/direnv.plugin.bash
Expand All @@ -115,6 +108,7 @@ plugins/available/history.plugin.bash
plugins/available/hub.plugin.bash
plugins/available/java.plugin.bash
plugins/available/jekyll.plugin.bash
plugins/available/jgitflow.plugin.bash
plugins/available/jump.plugin.bash
plugins/available/latex.plugin.bash
plugins/available/less-pretty-cat.plugin.bash
Expand All @@ -134,6 +128,7 @@ plugins/available/rbenv.plugin.bash
plugins/available/ruby.plugin.bash
plugins/available/textmate.plugin.bash
plugins/available/todo.plugin.bash
plugins/available/url.plugin.bash
plugins/available/xterm.plugin.bash
plugins/available/zoxide.plugin.bash

Expand All @@ -159,9 +154,13 @@ themes/bobby-python
themes/brainy
themes/brunton
themes/candy
themes/clean
themes/easy
themes/elixr
themes/essential
themes/githelpers.theme.bash
themes/inretio
themes/lambda
themes/modern
themes/norbu
themes/oh-my-posh
Expand All @@ -171,6 +170,7 @@ themes/powerline
themes/pure
themes/purity


# vendor init files
#
vendor/.gitattributes
8 changes: 4 additions & 4 deletions completion/available/aliases.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function _bash-it-component-completion-callback-on-init-aliases() {
completions=("${completions[@]##complete -* * -}") # strip all but last option plus trigger(s)
completions=("${completions[@]#complete -}") # strip anything missed
completions=("${completions[@]#? * }") # strip last option and arg, leaving only trigger(s)
completions=("${completions[@]#? }") # strip anything missed
completions=("${completions[@]#? }") # strip anything missed
#TODO: this will fail on some completions...

# create temporary file for wrapper functions and completions
Expand All @@ -40,10 +40,10 @@ function _bash-it-component-completion-callback-on-init-aliases() {
line="${line#alias -- }"
line="${line#alias }"
alias_name="${line%%=*}"
alias_defn="${line#*=\'}" # alias definition
alias_defn="${line#*=\'}" # alias definition
alias_defn="${alias_defn%\'}"
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
if [[ ${alias_defn} == ${alias_cmd} ]]; then
if [[ ${alias_defn} == "${alias_cmd}" ]]; then
alias_args=''
else
alias_args="${alias_defn#*[[:space:]]}" # everything after first word
Expand Down Expand Up @@ -89,7 +89,7 @@ function _bash-it-component-completion-callback-on-init-aliases() {
prec_word=\${prec_word#* }
fi
(( COMP_CWORD += ${#alias_arg_words[@]} ))
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[@]}\" \"\${COMP_WORDS[@]:1}\")
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[*]}\" \"\${COMP_WORDS[@]:1}\")
(( COMP_POINT -= \${#COMP_LINE} ))
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
(( COMP_POINT += \${#COMP_LINE} ))
Expand Down
4 changes: 3 additions & 1 deletion completion/available/export.completion.bash
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
complete -o nospace -S = -W '$(printenv | awk -F= "{print \$1}")' export
# shellcheck shell=bash

complete -o nospace -S = -W "$(printenv | awk -F= "{print \$1}")" export
15 changes: 15 additions & 0 deletions docs/themes-list/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,21 @@ Envy

----

Inretio
^^^^^^^


.. image:: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-black.png
:target: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-black.png
:alt: Inretio theme in dark color scheme


.. image:: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-white.png
:target: https://raw.githubusercontent.com/inretio/bash-it/gh-pages/docs/images/inretio-white.png
:alt: Inretio theme in light color scheme

----

Iterate
^^^^^^^

Expand Down
31 changes: 31 additions & 0 deletions docs/themes-list/inretio.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. _inretio:

Inretio Theme
=============

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.

Inspired by existing themes:
- metal
- bobby

Examples
--------

In Git-tracked folder:

.. code-block:: bash
┌──[2024-03-20 12:05:07] 🐧 gytis 💻 gytis-legion 📂 bash-it on 🌵 theme-inretio ⌀1 ✗
> ls
aliases clean_files.txt custom hooks lib lint_clean_files.sh profiles template test_lib uninstall.sh
bash_it.sh completion docs install.sh LICENSE plugins scripts test themes vendor
In Python virtual environment:

.. code-block:: bash
┌──[2024-03-20 12:07:32] 🐧 gytis 💻 gytis-legion 🐍 3.12.2 on [general] 📂 general
> ls
bin include lib lib64 pyvenv.cfg share
2 changes: 1 addition & 1 deletion docs/themes-list/powerline-base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv``
and ``conda`` supported)
* ``ruby`` - Current ruby version if using ``rvm``
* ``node`` - Current node version (only ``nvm`` is supported)
* ``node`` - Current node version (``nvm`` is the default strategy; set ``NODE_VERSION_STRATEGY`` to ``node`` to use ``node --version``)
* ``scm`` - Version control information, ``git``
* ``terraform`` - Current terraform workspace
* ``user_info`` - Current user
Expand Down
3 changes: 2 additions & 1 deletion hooks/dot-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ for file in "$@"; do
# Confirm expected schellcheck header
#
LINE1="$(head -n 1 "${file}")"
if [[ "${LINE1}" != "# shellcheck shell=bash" ]]; then
SCSH="${file##*.}"
if [[ "${LINE1}" != "# shellcheck shell=${SCSH}" ]]; then
echo "Bash include file \`${file}\` has bad/missing shellcheck header"
exit_code=1
fi
Expand Down
2 changes: 1 addition & 1 deletion lib/command_duration.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function _dynamic_clock_icon {
local clock_hand
# clock hand value is between 90 and 9b in hexadecimal.
# so between 144 and 155 in base 10.
printf -v clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144))
printf -v clock_hand '%x' $((((${1:-${SECONDS}} - 1) % 12) + 144))
printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand"
}

Expand Down
2 changes: 1 addition & 1 deletion lint_clean_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mapfile -t FILES < <(
cat clean_files.txt \
| grep -E -v '^\s*$' \
| grep -E -v '^\s*#' \
| xargs -n1 -I{} find "{}" -type f
| xargs -I{} find "{}" -type f
)

# We clear the BASH_IT variable to help the shellcheck checker
Expand Down
Loading

0 comments on commit 2697228

Please sign in to comment.