citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

rq (530B)


      1 #!/usr/bin/env bash
      2 
      3 set -e
      4 
      5 DOCS_DIR=${DOCS_DIR:-$HOME/docs}
      6 
      7 cmd=$(fuzz-reader $DOCS_DIR/queue)
      8 
      9 path=$(cut -f2 -d" " <<<"$cmd")
     10 fname=$(basename "$path")
     11 
     12 $cmd
     13 
     14 
     15 printf "Are you done with '$fname'?\n" >&2
     16 read -rep "(a)rchive, (d)elete, (q)uit: " reply
     17 
     18 case $reply in
     19 	[Dd]* )
     20 		rm -f "$path"
     21 		printf 'Deleting %s\n' "$fname" >&2
     22 		;;
     23 	[Aa]* )
     24 		mkdir -p "$DOCS_DIR/archive"
     25 		mv "$path" "$DOCS_DIR/archive"
     26 		mv "$DOCS_DIR/queue/.$fname.hst" "$DOCS_DIR/archive" || :
     27 		printf 'Archiving %s\n' "$fname" >&2
     28 		;;
     29 	* ) ;;
     30 esac