Latest version

This commit is contained in:
Sam Hardeman 2026-03-08 20:54:07 +01:00
parent e3a2efdb43
commit eb0aab1613
17 changed files with 815 additions and 328 deletions

40
shrc
View file

@ -1,4 +1,4 @@
#!/bin/echo Please run this program with: ". shrc" or include
#!/usr/bin/env -S echo Please run this program with: ". shrc" or include
# `FROM_RC=1 source shrc` in your RC file to set up an alias.
# Just opens your .rc file easily, for your current shell
@ -10,37 +10,9 @@ then
LD_INTERNAL=1 source $LD_SOURCE_FILE
fi
function md5_opt()
{
if [[ $daisy_has_md5sum -eq 1 ]];
then
echo $(md5sum "$1" | awk '{print $1}')
fi
}
shellname=$(basename $SHELL)
rc_name="."$shellname"rc"
rc_path="$HOME/$rc_name"
if [[ $FROM_RC -eq 1 ]]; then
alias shrc=". shrc"
else
shellname=$(basename $SHELL)
rc_name="."$shellname"rc"
rc_path="$HOME/$rc_name"
# Optional MD5 checks
has_changed=1
sum1=$(md5_opt "$rc_path")
# This sets a default if the variable does not exist.
EDITOR=${EDITOR:-$(ched)}
$EDITOR "$rc_path"
wait_for_editor $EDITOR "$rc_path"
sum2=$(md5_opt "$rc_path")
if [[ $daisy_has_md5sum -eq 1 && "$sum1" == "$sum2" ]];
then
echo "The RC-file $rc_name has not changed on disk. Not sourcing."
return
fi
source "$rc_path"
fi
daisy_editor "$rc_path"
source "$rc_path"