dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 2e2ea2c630821cb91f543bccf0ce986d572cab54
parent 78f19e50cafb676068850ce98afd716edd75594d
Author: hhvn <dev@hhvn.uk>
Date:   Sun, 11 Jul 2021 17:20:29 +0100

.s/b/sfeed_addfeed: prepend feed to sfeed config

Diffstat:
A.scripts/bin/sfeed_addfeed | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/.scripts/bin/sfeed_addfeed b/.scripts/bin/sfeed_addfeed @@ -0,0 +1,23 @@ +#!/bin/sh + +_config=$HOME/.config/sfeed/config +_backup=$_config.bkp + +[ -z $1 ] && echo "usage: $(basename $0) <uri>" && exit 2 +name=$(</dev/null dmenu -p "Feed title:") +[ -z "$name" ] && exit 99 + +mv $_config $_backup +awk -v"uri=$1" -v"title=$name" ' +/^feeds\(\)/ { + add=1 +} + +$1 == "feed" && add { + add=0 + printf "\tfeed \"%s\" \"%s\"\n", title, uri +} + +{ + print +}' < $_backup > $_config