Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4972652

Browse files
authoredNov 6, 2024··
Merge branch 'master' into theme
2 parents 178e24f + b55db47 commit 4972652

File tree

10 files changed

+182
-22
lines changed

10 files changed

+182
-22
lines changed
 

‎aliases/available/git.aliases.bash

Lines changed: 18 additions & 6 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
@@ -97,6 +103,9 @@ fi
97103

98104
# merge
99105
alias gm='git merge'
106+
alias gma='git merge --abort'
107+
alias gmc='git merge --continue'
108+
alias gms='git merge --squash'
100109

101110
# mv
102111
alias gmv='git mv'
@@ -107,7 +116,8 @@ alias gpatch='git format-patch -1'
107116
# push
108117
alias gp='git push'
109118
alias gpd='git push --delete'
110-
alias gpf='git push --force'
119+
alias gpf='git push --force-with-lease'
120+
alias gpff='git push --force'
111121
alias gpo='git push origin HEAD'
112122
alias gpom='git push origin $(get_default_branch)'
113123
alias gpu='git push --set-upstream'
@@ -129,10 +139,13 @@ alias grv='git remote -v'
129139

130140
# rm
131141
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.
132143

133144
# rebase
134145
alias grb='git rebase'
146+
alias grba='git rebase --abort'
135147
alias grbc='git rebase --continue'
148+
alias grbi='git rebase --interactive'
136149
alias grm='git rebase $(get_default_branch)'
137150
alias grmi='git rebase $(get_default_branch) -i'
138151
alias grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
@@ -152,6 +165,8 @@ alias gsl='git shortlog -sn'
152165

153166
# show
154167
alias gsh='git show'
168+
alias gshn='git show --name-only'
169+
alias gshns='git show --name-status'
155170

156171
# svn
157172
alias gsd='git svn dcommit'
@@ -204,9 +219,6 @@ function gdv() {
204219
}
205220

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

‎clean_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ themes/candy
162162
themes/easy
163163
themes/essential
164164
themes/githelpers.theme.bash
165+
themes/inretio
165166
themes/lambda
166167
themes/modern
167168
themes/norbu

‎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+

‎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

‎plugins/available/gif.plugin.bash

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ function v2gif() {
7272
eval set -- "$args"
7373
local use_gifski=""
7474
local opt_del_after=""
75-
local maxsize=""
76-
local lossiness=""
77-
local maxwidthski=""
75+
local maxsize=()
76+
local lossiness=()
77+
local maxwidthski=()
7878
local giftagopt=""
7979
local giftag=""
8080
local defaultfps=10
@@ -106,8 +106,8 @@ function v2gif() {
106106
shift
107107
;;
108108
-w | --width)
109-
maxsize="-vf scale=$2:-1"
110-
maxwidthski="-W $2"
109+
maxsize=(-vf "scale=$2:-1")
110+
maxwidthski=(-W "$2")
111111
giftag="${giftag}-w$2"
112112
shift 2
113113
;;
@@ -118,7 +118,7 @@ function v2gif() {
118118
;;
119119
-l | --lossy)
120120
# Use giflossy parameter
121-
lossiness="--lossy=$2"
121+
lossiness=("--lossy=$2")
122122
giftag="${giftag}-l$2"
123123
shift 2
124124
;;
@@ -164,7 +164,7 @@ function v2gif() {
164164
local del_after=$opt_del_after
165165

166166
if [[ -n "$make_webm" ]]; then
167-
$ffmpeg -loglevel panic -i "$file" \
167+
$ffmpeg -loglevel warning -i "$file" \
168168
-c:v libvpx -crf 4 -threads 0 -an -b:v 2M -auto-alt-ref 0 \
169169
-quality best -loop 0 "${file%.*}.webm" || return 2
170170
fi
@@ -184,12 +184,12 @@ function v2gif() {
184184

185185
if [[ "$use_gifski" = "true" ]]; then
186186
# I trust @pornel to do his own resizing optimization choices
187-
$ffmpeg -loglevel panic -i "$file" -r "$fps" -vcodec png v2gif-tmp-%05d.png \
188-
&& $gifski v2gif-tmp-*.png "$maxwidthski" --fps "$(printf "%.0f" "$fps")" -o "$output_file" || return 2
187+
$ffmpeg -loglevel warning -i "$file" -r "$fps" -vcodec png v2gif-tmp-%05d.png \
188+
&& $gifski "${maxwidthski[@]}" --fps "$(printf "%.0f" "$fps")" -o "$output_file" v2gif-tmp-*.png || return 2
189189
else
190-
$ffmpeg -loglevel panic -i "$file" "$maxsize" -r "$fps" -vcodec png v2gif-tmp-%05d.png \
190+
$ffmpeg -loglevel warning -i "$file" "${maxsize[@]}" -r "$fps" -vcodec png v2gif-tmp-%05d.png \
191191
&& $convert +dither -layers Optimize v2gif-tmp-*.png GIF:- \
192-
| $gifsicle "$lossiness" --no-warnings --colors 256 --delay="$(echo "100/$fps" | bc)" --loop --optimize=3 --multifile - > "$output_file" || return 2
192+
| $gifsicle "${lossiness[@]}" --no-warnings --colors 256 --delay="$(echo "100/$fps" | bc)" --loop --optimize=3 --multifile - > "$output_file" || return 2
193193
fi
194194

195195
rm v2gif-tmp-*.png
@@ -299,7 +299,7 @@ function any2webm() {
299299

300300
echo "$(tput setaf 2)Creating '$output_file' ...$(tput sgr 0)"
301301

302-
$ffmpeg -loglevel panic -i "$file" \
302+
$ffmpeg -loglevel warning -i "$file" \
303303
-c:v libvpx -crf 4 -threads 0 -an -b:v "$bandwidth" -auto-alt-ref 0 \
304304
-quality best "$fps" "$size" -loop 0 -pix_fmt yuva420p "$output_file" || return 2
305305

‎template/bash_profile.template.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export BASH_IT="{{BASH_IT}}"
1111

1212
# Lock and Load a custom theme file.
1313
# Leave empty to disable theming.
14-
# location /.bash_it/themes/
14+
# location "$BASH_IT"/themes/
1515
export BASH_IT_THEME='bobby'
1616

1717
# Some themes can show whether `sudo` has a current token or not.

‎themes/brainy/brainy.theme.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ ___brainy_prompt_battery() {
168168
box="[|]"
169169
ac_adapter_connected && charging="+"
170170
ac_adapter_disconnected && charging="-"
171-
info+=$charging
171+
info+="$charging"
172172
[ "$info" == "100+" ] && info="AC"
173173
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
174174
}

‎themes/inretio/inretio.theme.bash

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
3+
4+
# Inretio theme for Bash-it
5+
# Contact: bashit@inretio.eu
6+
7+
# Inspired by existing themes:
8+
# - metal
9+
# - bobby
10+
11+
# virtualenv prompts
12+
VIRTUALENV_CHAR=""
13+
VIRTUALENV_THEME_PROMPT_PREFIX=""
14+
VIRTUALENV_THEME_PROMPT_SUFFIX=""
15+
16+
# SCM prompts
17+
SCM_NONE_CHAR=""
18+
SCM_GIT_CHAR="[±] "
19+
SCM_GIT_BEHIND_CHAR="${red}${normal}"
20+
SCM_GIT_AHEAD_CHAR="${bold_green}${normal}"
21+
SCM_GIT_UNTRACKED_CHAR=""
22+
SCM_GIT_UNSTAGED_CHAR="${bold_yellow}${normal}"
23+
SCM_GIT_STAGED_CHAR="${bold_green}+${normal}"
24+
25+
SCM_THEME_PROMPT_DIRTY=""
26+
SCM_THEME_PROMPT_CLEAN=""
27+
SCM_THEME_PROMPT_PREFIX=""
28+
SCM_THEME_PROMPT_SUFFIX=""
29+
30+
# Git status prompts
31+
GIT_THEME_PROMPT_DIRTY=" ${red}${normal}"
32+
GIT_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
33+
GIT_THEME_PROMPT_PREFIX=""
34+
GIT_THEME_PROMPT_SUFFIX=""
35+
36+
# ICONS =======================================================================
37+
38+
icon_start="┌──"
39+
icon_user=" 🐧 "
40+
icon_host=" 💻 "
41+
icon_directory=" 📂 "
42+
icon_branch="🌵"
43+
icon_end="└> "
44+
45+
# extra spaces ensure legiblity in prompt
46+
47+
# FUNCTIONS ===================================================================
48+
49+
# Display virtual environment info
50+
function _virtualenv_prompt {
51+
VIRTUALENV_DETAILS=""
52+
VIRTUALENV_CHAR=""
53+
54+
# $VIRTUAL_ENV is set and is non-zero length
55+
if [[ -n "$VIRTUAL_ENV" ]]; then
56+
# Check if Python 3 exists
57+
if command -v python3 >/dev/null 2>&1; then
58+
VIRTUALENV_DETAILS="$($VIRTUAL_ENV/bin/python --version | sed 's,Python ,,') on [$(basename $VIRTUAL_ENV)]"
59+
VIRTUALENV_CHAR=" 🐍"
60+
else
61+
VIRTUALENV_DETAILS="[$(basename $VIRTUAL_ENV)]"
62+
VIRTUALENV_CHAR=""
63+
fi
64+
fi
65+
66+
echo "$VIRTUALENV_CHAR $VIRTUALENV_DETAILS"
67+
}
68+
69+
# Rename tab
70+
function tabname {
71+
printf "\e]1;$1\a"
72+
}
73+
74+
# Rename window
75+
function winname {
76+
printf "\e]2;$1\a"
77+
}
78+
79+
_theme_clock() {
80+
printf '[%s]' "$(clock_prompt)"
81+
82+
if [ "${THEME_SHOW_CLOCK_CHAR}" == "true" ]; then
83+
printf '%s' "$(clock_char) "
84+
fi
85+
}
86+
THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"false"}
87+
THEME_CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$red"}
88+
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"}
89+
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%Y-%m-%d %H:%M:%S"}
90+
91+
# PROMPT OUTPUT ===============================================================
92+
93+
# Displays the current prompt
94+
function prompt_command() {
95+
PS1="\n${icon_start}$(_theme_clock)${icon_user}${bold_green}\u${normal}${icon_host}${bold_cyan}\h${normal}${green}$(_virtualenv_prompt)${normal}${icon_directory}${bold_purple}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} $(scm_prompt_info) \")${white}${normal}\n${icon_end}"
96+
PS2="${icon_end}"
97+
}
98+
99+
# Runs prompt (this bypasses bash_it $PROMPT setting)
100+
safe_append_prompt_command prompt_command

‎themes/oh-my-posh/oh-my-posh.theme.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
if _command_exists oh-my-posh; then
44
export POSH_THEME=${POSH_THEME:-https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json}
5-
eval "$(oh-my-posh --init --shell bash --config "${POSH_THEME}")"
5+
eval "$(oh-my-posh init bash --config "${POSH_THEME}")"
66
else
77
_log_warning "The oh-my-posh binary was not found on your PATH. Falling back to your existing PS1, please see the docs for more info."
88
fi

0 commit comments

Comments
 (0)
Please sign in to comment.