From 1cce1a9a3835354e0fad0f4bde11bbebc08ba93d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 18 Sep 2024 16:49:48 +0200 Subject: [PATCH] writing: Remove bib-due scripts and update README Removed the left-over bib-due scripts. They were neat and fun when I wrote them but they are not useful for me anymore. Additionally they are very brittle and I do not want to deal with fixing or updating them. --- writing/.local/bin/bib-due | 147 -------------------------------- writing/.local/bin/rofi-bib-due | 29 ------- writing/README.md | 72 +++------------- 3 files changed, 11 insertions(+), 237 deletions(-) delete mode 100755 writing/.local/bin/bib-due delete mode 100755 writing/.local/bin/rofi-bib-due diff --git a/writing/.local/bin/bib-due b/writing/.local/bin/bib-due deleted file mode 100755 index 032f513..0000000 --- a/writing/.local/bin/bib-due +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env sh -# shows due entries of bibtex file passed in -# HACK: brittle! will break on various bibfile abnormities (even just on due date w/o priority) -# FIXME: reimplementation with real library needed -# - -OPTIND=1 # Reset in case getopts has been used previously in the shell. -fields="due|priority|\bauthor\b|\btitle\b" -filterby="due" -file="${BIBFILE}" -until="" - -show_help() { - printf "%s\n" \ - "" \ - " bib-due Show due readings from bibtex file." \ - "" \ - " Usage: bib-due [-hv] -i input.bib -r 'due|priority|\bauthor|\btitle' -l 'due' -u '2020-05-12'" \ - "" \ - " Options:" \ - "" \ - " -i [bibtex-file] Input bibtex file to scrape and get items from." \ - "" \ - " -r [fields] Field values to read in file." \ - "" \ - " -l [filter] Field to use as filter entity." \ - " This field is required for the scraper to pick entries up." \ - "" \ - " help | -h | --help Print out this help." \ - "" \ - " Invoked without arguments, bib-due will scrape the file defined in BIBFILE environment variable, " \ - " filtering entries with the 'due' field, and getting the values for 'due', 'priority', 'author', " \ - " and 'title' fields. It will then print the entries to stdout." \ - "" \ - " Example output line:" \ - "" \ - ' 2020-06-25 (1): Sergei Gerasymchuk -- “Ze” time in Ukraine (Gerasymchuk2019) ' \ - "" -} - -filter_until() { - # filter for dates, with line numbers - filtered=$(echo "$entries" | grep -noE '[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}') - - # redirect entries to fifo pipe - mkfifo filteredentries - finish() { - rm filteredentries - } - trap finish EXIT - echo "$filtered" >filteredentries & - - # find first date past until filter - lastline="" - while IFS= read -r line; do - cond=$(printf '%s' "$line" | cut -d: -f2) - cond=$(date -d "$cond" +%s) - if [ "$cond" -gt "$until" ]; then - lastline=$(printf '%s' "$line" | cut -d: -f1) - break - fi - done