From 0e9dbbd0725bf58b062593060726b2f3f1291021 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 28 Feb 2021 01:22:31 +0000 Subject: [PATCH] Add functions --- bash/.bash_functions | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/bash/.bash_functions b/bash/.bash_functions index 4979076..e9118d4 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -12,13 +12,26 @@ function update-dotfiles() { cd $prevdir } +# Function to manage basic stowage tasks as stow +function stow() { + if [ -d "${HOME}/.dotfiles" ]; then + if [ -d "${HOME}/.dotfiles/$1" ]; then + $HOME/.dotfiles/bin/bin/stowage $HOME/.dotfiles/$1 + else + echo "Can't find $1 to stow" + echo "List of packages:" + ls -1 $HOME/.dotfiles + fi + fi +} + function add-sshkey() { TIMEOUT="2h" NAME=$1 if [ -z "$NAME" ]; then echo "Current Keys" - ssh-add -L + ssh-add -L | cut -d" " -f 3- else if [ -f "${HOME}/.ssh/id_ed25519_${NAME}" ]; then ssh-add -t $TIMEOUT "${HOME}/.ssh/id_ed25519_${NAME}" @@ -35,7 +48,19 @@ function demoprompt() { unset OLDPS1 else OLDPS1=$PS1 - PS1="\$ " + PS1=" \$ " clear fi } + +function commit-pkm() { + if [ -d $HOME/Documents/pkm ]; then + cd ~/Documents/pkm + if [[ `git status --porcelain` ]]; then + echo "Changes detected, commiting..." + git add -A && git commit -a -m 'Manual savepoint' && git push origin + else + echo "No changes detected" + fi + fi +} \ No newline at end of file