X-Git-Url: https://software.frrobert.com/lace/blobdiff_plain/80fdda3143ebb6fcd1bae4e7176b8d3a1ace415f..98313b4d1d564d53fbddc4e74e29f6a54ad530a6:/lacedreader diff --git a/lacedreader b/lacedreader new file mode 100755 index 0000000..9756e89 --- /dev/null +++ b/lacedreader @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# forked from https://gitlab.com/uoou/dotfiles/-/tree/master/stow/bin/home/drew/.local/bin/lace +# https://raw.githubusercontent.com/frrobert2/lace/main/lace +# Shows both how many days ago and date +# Modified to work with Debian running Sed 3.7 +# connectto is a timeout variable in seconds +# it is the time lace will wait to connect to a site before it stops the connection +# default is 30 seconds you can change it what you want +connectto=30 +set -o pipefail +if [ -z "$XDG_CONFIG_HOME" ];then + config_place="$HOME/.config/lace" +else + config_place="$XDG_CONFIG_HOME/lace" +fi + + + if [[ "$1" == "nope" ]];then + cat $config_place/microblogs.gmi + else + less -RisW $config_place/microblogs.gmi + fi + + + if [[ "$1" == "help" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "-help" ]] || [[ "$1" == "-h" ]];then + dohelp + elif [[ "$1" == "sub" ]];then + [[ "$#" -ne 3 ]] && dohelp + echo "$3 $2" >> $subsfile && echo "added $2 to subscriptions" +elif [[ "$1" == "unsub" ]];then + [[ "$#" -ne 2 ]] && dohelp + if grep " $2$" $subsfile 1>/dev/null;then + sed -i "/ $2$/d" $subsfile && + echo "removed subscription to $2" + else + echo "subscription \"$2\" does not exist" + fi +elif [[ "$1" == "subs" ]];then + awk '{print $2" ("$1")"}' $subsfile +elif [[ "$1" == "update" ]];then + curl https://raw.githubusercontent.com/frrobert2/lace/main/lacedreader > "${BASH_SOURCE[0]}" +fi