Files
shell_sequencer/seqs/git.sh

53 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
toolName=git
# Get script working directory
# (when called from a different directory and even when called via symlink)
WDIR="$(cd "$(dirname -- "$(realpath ${BASH_SOURCE[0]})")" >>/dev/null 2>&1 && pwd)"
APTOPT=
CONFIG=0
SCRIPT_FILE=$(basename -- $0)
SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() {
## or to use sequencer api with global config file:
#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
#if [ $? -eq 0 ] ; then
# CONFIG=1
#else
# # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1
#fi
## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y"
## Return of non zero value will abort the sequence
return 0
}
step_1_info() { echo "Setup global git aliases"; }
step_1_alias() { ALIAS="alias"; }
step_1() {
local brConf="branch \
--format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - \
%(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' \
--sort=-committerdate"
local logConf="!git log --pretty=format:\"%C(magenta)%h%Creset \
-%C(red)%d%Creset %s %C(dim green)(%cr) [%an]\" --abbrev-commit -30"
exe git config --global alias.s 'status -s'
exe git config --global alias.st 'status'
exe git config --global alias.co 'checkout'
exe git config --global alias.ci 'commit'
exe git config --global alias.b "${brConf}"
exe git config --global alias.br 'branch'
exe git config --global alias.l "${logConf}"
exe git config --global alias.ll 'log'
}
VERSION_SEQREV=15
. /usr/local/bin/sequencer.sh