Recently Written · git

dmenu-scripts

Ask for things

git clone https://github.com/equwal/dmenu-scripts

Log | Files | Refs


drssadd (927 bytes)

1 #!/bin/sh
2 
3 #don't forget to set $USERTAGS and $BOOKMARKS to whatever path
4 
5 DMENULINES=15
6 
7 help () {
8     echo "Call without an argument to be prompted with dmenu."
9     echo "Flags:"
10     printf "-h, --help\n-a, --add\n-e, --edit\n"
11 }
12 
13 add () {
14     url="$(xclip -o | dmenu -p 'RSS url: ')"
15     desc="$(dmenu -p 'description: ')"
16 
17     [ ! -e "$url" ] && printf "%s \"%s\"\\n" "$url" "$desc" >>"$NEWBOAT_RSS_URLS"
18 }
19 
20 edit () {
21     echo "Not implemented. Edit \$NEWSBOAT_RSS_URLS yourself at $NEWSBOAT_RSS_URLS." && exit 1
22 }
23 
24 promptflag () {
25 
26     action="$(printf 'add\nedit (not implemented)\n' | dmenu -l 4 -p 'action:')"
27     [ "$action" = "edit" ]  && edit
28     [ "$action" = "add" ]   && add
29 }
30 
31 [ "$1" = '-h' ] || [ "$1" = '--help' ] && help
32 [ "$1" = '-a' ] || [ "$1" = '--add' ]  && add
33 [ "$1" = '-e' ] || [ "$1" = '--edit' ] && edit
34 [ -z "$1" ] && promptflag
35 [ -n "$2" ] && echo "Too many arguments: use one or none." && exit 1