commit a60bbc5d5c623fd13aff0039350d513d98690d72 Spenser Truex <truex@equwal.com> 2025-09-01 19:39:24 -0400 drssadd: add RSS links to the newsboat config from clipboad
README.md | 1 + drssadd | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
diff --git a/README.md b/README.md index 3f07bdf..2488e02 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ with that. - `dmenupass`: ask for the sudo password as SUDO_ASKPASS - `dmount/dunmount`: mount/unmound drives - `dopenrc-runlevel`: choose openrc runlevels for various advanced tasks like networking +- `drssadd`: add RSS links to the newsboat config from clipboad - `dshow`: run a command and show output without having to open a terminal - `dsysact`: reboot/shutdown/etc. - `passmenu`: unix [`pass`](https://www.passwordstore.org/) interface diff --git a/drssadd b/drssadd new file mode 100755 index 0000000..62658ea --- /dev/null +++ b/drssadd @@ -0,0 +1,35 @@ +#!/bin/sh + +#don't forget to set $USERTAGS and $BOOKMARKS to whatever path + +DMENULINES=15 + +help () { + echo "Call without an argument to be prompted with dmenu." + echo "Flags:" + printf "-h, --help\n-a, --add\n-e, --edit\n" +} + +add () { + url="$(xclip -o | dmenu -p 'RSS url: ')" + desc="$(dmenu -p 'description: ')" + + [ ! -e "$url" ] && printf "%s \"%s\"\\n" "$url" "$desc" >>"$NEWBOAT_RSS_URLS" +} + +edit () { + echo "Not implemented. Edit \$NEWSBOAT_RSS_URLS yourself at $NEWSBOAT_RSS_URLS." && exit 1 +} + +promptflag () { + + action="$(printf 'add\nedit (not implemented)\n' | dmenu -l 4 -p 'action:')" + [ "$action" = "edit" ] && edit + [ "$action" = "add" ] && add +} + +[ "$1" = '-h' ] || [ "$1" = '--help' ] && help +[ "$1" = '-a' ] || [ "$1" = '--add' ] && add +[ "$1" = '-e' ] || [ "$1" = '--edit' ] && edit +[ -z "$1" ] && promptflag +[ -n "$2" ] && echo "Too many arguments: use one or none." && exit 1