will not look for favicon.txt by default
[lace] / lacedreader
1 #!/usr/bin/env bash
2
3 # forked from https://gitlab.com/uoou/dotfiles/-/tree/master/stow/bin/home/drew/.local/bin/lace
4 # https://raw.githubusercontent.com/frrobert2/lace/main/lace
5 # Shows both how many days ago and date
6 # Modified to work with Debian running Sed 3.7
7 # connectto is a timeout variable in seconds 
8 # it is the time lace will wait to connect to a site before it stops the connection
9 #  default is 30 seconds you can change it what you want
10 connectto=30
11 set -o pipefail
12 if [ -z "$XDG_CONFIG_HOME" ];then
13         config_place="$HOME/.config/lace"
14 else
15         config_place="$XDG_CONFIG_HOME/lace"
16 fi
17        
18
19                 if [[ "$1" == "nope" ]];then
20                         cat $config_place/microblogs.gmi 
21                 else
22                         less -RisW $config_place/microblogs.gmi
23                 fi
24         
25
26         if [[ "$1" == "help" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "-help" ]] || [[ "$1" == "-h" ]];then
27                 dohelp
28         elif [[ "$1" == "sub" ]];then
29                 [[ "$#" -ne 3 ]] && dohelp
30                 echo "$3 $2" >> $subsfile && echo "added $2 to subscriptions"
31 elif [[ "$1" == "unsub" ]];then
32         [[ "$#" -ne 2 ]] && dohelp
33         if grep " $2$" $subsfile 1>/dev/null;then
34                 sed -i "/ $2$/d" $subsfile &&
35                 echo "removed subscription to $2"
36         else
37                 echo "subscription \"$2\" does not exist"
38         fi
39 elif [[ "$1" == "subs" ]];then
40         awk '{print $2" ("$1")"}' $subsfile 
41 elif [[ "$1" == "update" ]];then
42         curl https://raw.githubusercontent.com/frrobert2/lace/main/lacedreader > "${BASH_SOURCE[0]}"
43 fi