Adding a refactor to dedicated files instead of a massive header
This commit is contained in:
41
EtcFiles/profile.d/shadowarch-ssh.sh
Normal file
41
EtcFiles/profile.d/shadowarch-ssh.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
### SSH ###
|
||||
# Tell shell about ssh-agent -- enable with 'systemctl --user enable --now ssh-agent.service'
|
||||
export SSH_AGENT_PID="$(pgrep -fu "$USER" ssh-agent)"
|
||||
if [ -n "$SSH_AGENT_PID" ]; then
|
||||
export SSH_AUTH_SOCK="/run/user/$EUID/ssh-agent.socket"
|
||||
echo ssh-agent PID is $SSH_AGENT_PID
|
||||
fi
|
||||
if [ -n "$SSH_AUTH_SOCK" ] && [ `ssh-add -L | grep -c no\ identities` -eq 1 ]; then
|
||||
ssh-add
|
||||
ssh-add -L
|
||||
fi
|
||||
|
||||
# Tmux help
|
||||
function tssh () {
|
||||
tmux new-window -n "$1" "/bin/bash -ilc 'ssh $1'"
|
||||
}
|
||||
|
||||
### GIT ###
|
||||
source /usr/share/git/completion/git-prompt.sh
|
||||
|
||||
function git_prompt_var() {
|
||||
### If $PWD is a Git repo, add URL and branch to PS1
|
||||
url=`git config remote.origin.url 2>/dev/null`
|
||||
if [ -n "$url" ]; then
|
||||
branch=`__git_ps1 '%s'`
|
||||
url=`basename "$url"`
|
||||
echo " $url($branch)"
|
||||
fi
|
||||
}
|
||||
|
||||
### User-directory .gitbare Support (Git) ###
|
||||
if [ -d ~/.git ]; then
|
||||
cd
|
||||
printf "~/.git: "
|
||||
if [ $SHLVL -eq 1 ] && [ -z "$TMUX" ]; then
|
||||
git pull
|
||||
else
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
git status
|
||||
fi
|
||||
Reference in New Issue
Block a user