From 45e44797b5b250063feda4f95dc21c44b2b8e400 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 2 Apr 2023 18:40:47 -0400 Subject: [PATCH] rem.sh: added script simple reminder utility --- src/.config/fish/config.fish | 20 +++++++----- src/.local/bin/rem.sh | 60 ++++++++++++++++++++++++++++++++++++ src/.profile | 4 +++ 3 files changed, 76 insertions(+), 8 deletions(-) create mode 100755 src/.local/bin/rem.sh diff --git a/src/.config/fish/config.fish b/src/.config/fish/config.fish index 654a383..387912e 100644 --- a/src/.config/fish/config.fish +++ b/src/.config/fish/config.fish @@ -16,14 +16,18 @@ set -gx MANPATH "$MANPATH:/home/dogeystamp/.cache/cppman/" # Disable fish greeting set fish_greeting "" -source ~/.config/fish/functions/prompts.fish -source ~/.config/fish/functions/extra_prompt.fish +if status --is-interactive + source ~/.config/fish/functions/prompts.fish + source ~/.config/fish/functions/extra_prompt.fish -# Enable Vi bindings -fish_hybrid_key_bindings + # Enable Vi bindings + fish_hybrid_key_bindings -set __fish_git_prompt_showdirtystate 1 -set __fish_git_prompt_showupstream auto + set __fish_git_prompt_showdirtystate 1 + set __fish_git_prompt_showupstream auto -set fish_color_param normal -set fish_color_cwd grey + set fish_color_param normal + set fish_color_cwd grey + + rem.sh show +end diff --git a/src/.local/bin/rem.sh b/src/.local/bin/rem.sh new file mode 100755 index 0000000..6e7cfca --- /dev/null +++ b/src/.local/bin/rem.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# simple todo utility +# nags me every time i start a shell + +set -e + +scriptname=$0 +subcmd=$1 + +if [ -z "$REM_FILE" ]; then + REM_FILE="$HOME/.reminder-file" + touch "$REM_FILE" +fi + +sub_help() { + echo "usage:" + echo " $scriptname [options]" + echo + echo "commands:" + echo " show show all entries" + echo " add append new entry" + echo ' edit open reminder file in $EDITOR' + echo + echo "Set $REM_FILE" +} + +sub_show() { + REMS="$(cat "$REM_FILE" | sed -z 's/^\n$//g')" + if [ ! -z "$REMS" ]; then + printf "reminders:\n\n%s\n\n" "$REMS" + fi +} + +sub_add() { + TMP="$(mktemp)" + $EDITOR "$TMP" + cat "$TMP" >> "$REM_FILE" +} + +sub_edit() { + $EDITOR "$REM_FILE" +} + +sub_congrats() { + notify-send -a "🎉" "congrats" +} + +case $subcmd in + "" | "--help" | "-h") + sub_help + ;; + *) + shift + sub_${subcmd} "$@" + if [ $? = 127 ]; then + echo "error: unknown command '$subcmd'" + exit 1 + fi + ;; +esac diff --git a/src/.profile b/src/.profile index 20fa577..7311db8 100644 --- a/src/.profile +++ b/src/.profile @@ -32,9 +32,13 @@ export GOPATH="$HOME"/.local/go export npm_config_userconfig=$XDG_CONFIG_HOME/npm/config export npm_config_cache=$XDG_CACHE_HOME/npm export npm_config_prefix=$XDG_DATA_HOME/npm + # minrss scripts export MRSS_DIR="$HOME/dox/rss" +# reminder script +export REM_FILE="$HOME/dox/not/rem" + # Set default programs export EDITOR="nvim" export BROWSER="qutebrowser"