fix indentation

Signed-off-by: Michael Grote <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2023-08-30 13:44:27 +02:00
parent 4d6d9b620d
commit 7c196c4427

View file

@ -109,7 +109,7 @@ function ssh {
if [ -n "${TMUX}" ]; then if [ -n "${TMUX}" ]; then
tmux rename-window "${@: -1}" tmux rename-window "${@: -1}"
fi fi
command ssh "$@" command ssh "$@"
if [ -n "${TMUX}" ]; then if [ -n "${TMUX}" ]; then
tmux rename-window "$(hostname -f)" tmux rename-window "$(hostname -f)"
fi fi
@ -141,19 +141,19 @@ Options:
Author: Author:
michael.grote@posteo.de - git.mgrote.net michael.grote@posteo.de - git.mgrote.net
EOF EOF
;; ;;
--new-branch | -b) --new-branch | -b)
(git checkout --quiet -b "$2" && git push --set-upstream "$(git remote | head -n 1)" "$2" && echo '>>> Create new branch "'"$2"'"') || (git checkout --quiet -b "$2" && git push --set-upstream "$(git remote | head -n 1)" "$2" && echo '>>> Create new branch "'"$2"'"') ||
(git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ') (git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ')
;; ;;
*) *)
if [ ! -z $1 ] ; then if [ ! -z $1 ] ; then
(echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) || (echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) ||
(echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch!") (echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch!")
else else
(git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') || (git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') ||
(git checkout --quiet main > /dev/null 2>&1 && echo '>>> Try checking out main') || (git checkout --quiet main > /dev/null 2>&1 && echo '>>> Try checking out main') ||
(git checkout --quiet release > /dev/null 2>&1 && echo '>>> Try checking out release') (git checkout --quiet release > /dev/null 2>&1 && echo '>>> Try checking out release')
fi fi
esac esac
} }
@ -161,15 +161,15 @@ function glogs {
# https://git-scm.com/docs/pretty-formats # https://git-scm.com/docs/pretty-formats
# https://stackoverflow.com/questions/3631005/git-log-tabular-formatting # https://stackoverflow.com/questions/3631005/git-log-tabular-formatting
# https://stackoverflow.com/questions/7736781/how-to-make-git-log-not-prompt-to-continue # https://stackoverflow.com/questions/7736781/how-to-make-git-log-not-prompt-to-continue
if [ -z "$1" ]; then if [ -z "$1" ]; then
ncommits=30; ncommits=30;
else else
ncommits="$1"; ncommits="$1";
fi; fi;
git log --pretty=format:'%C(auto) %<|(16,trunc)%h %Cred %G?%Creset %<|(60,trunc)%s %<(20,trunc)%Cgreen%cr%Creset %<(15,trunc)%Cblue%an%Creset %Cred%D' --graph --all -$ncommits git log --pretty=format:'%C(auto) %<|(16,trunc)%h %Cred %G?%Creset %<|(60,trunc)%s %<(20,trunc)%Cgreen%cr%Creset %<(15,trunc)%Cblue%an%Creset %Cred%D' --graph --all -$ncommits
} }
function gp { function gp {
git pull "$@" git pull "$@"
} }
function mdtoc { function mdtoc {
grep --recursive --include="*.md" ^# | sort --version-sort --field-separator=":" | awk 'BEGIN {FS=":"}{print $2 "&&" $1}' | column --table --separator "&&" --table-truncate 1,2 grep --recursive --include="*.md" ^# | sort --version-sort --field-separator=":" | awk 'BEGIN {FS=":"}{print $2 "&&" $1}' | column --table --separator "&&" --table-truncate 1,2