Improve gbr and perl commands in jix-shell

This commit is contained in:
Jonas Ryssel 2022-08-27 12:33:40 +02:00
parent c4c0b0fc01
commit 5bf618a0e6

View File

@ -1,5 +1,6 @@
export EDITOR=nvim
export HOSTNAME=`hostname 2>/dev/null || hostnamectl hostname`
export RIPGREP_CONFIG_PATH=~/.ripgreprc
if [ $USER = 'knyffen' ] || ([ $HOSTNAME = 'jry-thinkpad-t470' ] && [ $USER = 'jry' ]); then
alias rm="trash"
@ -42,6 +43,9 @@ function ack_open { nvim $( ack -m 1 -T junkFiles "$@" | grep -Po "^(?:lib|t|tmp
# git
alias gst="git status"
if [ `alias | grep '\sgbr=' | wc -l` != 0 ]; then
unalias gbr
fi
# alias gbr="git branch --sort=-committerdate"
# function gbr2 { git branch --sort=-committerdate | perl -pE 'my $branch = $_ =~ s/^[*+]?\s(\S+)\s*$/$1/r; my $merged = qx{git log \$(git rev-parse $branch) ^master --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
function gbr { git branch --sort=-committerdate --format '%(if)%(HEAD)%(then)*%(else)%(if)%(worktreepath)%(then)+%(else) %(end)%(end) %(align:width=40,position=left)%(refname:short)%(end) %(align:width=10,position=right)%(color:green)(%(committerdate:relative))%(end)' | perl -pE '$_ =~ /^[*+]?\s+(?<branch>\S+)\s*/; my $branch = $+{branch}; my $merged = qx{git log \$(git rev-parse $branch) ^master --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
@ -198,7 +202,7 @@ if [ $HOSTNAME = 'gnu' ] && [ $USER = 'jry' ]; then
alias fzy="~/.fzy/fzy"
alias perlperl="/usr/bin/perl"
alias perlprove="/home/perl/bin/prove"
alias perlprove="/usr/bin/prove"
function prove { jix-shell TEST_METHOD=$TEST_METHOD BAIL_ON_FAIL=$BAIL_ON_FAIL prove "$@"; }
function prove-on-backend { jix-shell TEST_METHOD=$TEST_METHOD BAIL_ON_FAIL=$BAIL_ON_FAIL USER=$USER JIX_USERID=$JIX_USERID prove-on-backend "$@"; }
function perl { jix-shell TEST_METHOD=$TEST_METHOD BAIL_ON_FAIL=$BAIL_ON_FAIL USER=$USER JIX_USERID=$JIX_USERID perl -MJIX "$@"; }