entry_view.sh (1016B)
1 #!/bin/sh 2 3 PROGDIR="$(cd -- "$(dirname -- "$0")" && pwd)" 4 [ -z "$cal_dir" ] && . "$PROGDIR/config.sh" 5 6 # First param must be set to tmp file of dmenu line selection 7 [ ! -f "$1" ] && exit 1 8 9 # Second param is the note tmp file, if applicable 10 [ -n "$2" ] && [ -f "$2" ] && n="$2" || n="" 11 12 # Third param is typeflag, if todo, print it w desc color 13 [ -n "$3" ] && tf="$3" || tf="c" 14 15 <$1 sed "s/ \(<note> \)*<[0-9]\+\($rm_tag\)*\($n_tag\)*$//" | awk -v tf="$tf" ' 16 17 BEGIN{ x = 0 } 18 { 19 if ( FNR == 1 ) { x++ } 20 if ( x == 1 ){ 21 if ( tf == "t" ) { 22 print "'"$(tput setaf "$DESC_CLR")"'"$0 23 print "" 24 } else { 25 i = index( $0, ">" ) 26 a = substr( $0, 1, i - 2 ) 27 if ( match( $0, /\{[^}{]+\}$/ ) ){ 28 b = substr( $0, i + 2, RSTART - i - 2 ) 29 c = substr( $0, RSTART ) 30 }else{ 31 b = substr( $0, i + 2 ) 32 c = "" 33 } 34 print "'"$(tput setaf "$DATE_CLR")"'"a 35 if (c) { print "'"$(tput setaf "$RECUR_CLR")"'"c } 36 print "'"$(tput setaf "$DESC_CLR")"'"b 37 print "" 38 } 39 }else{ 40 print 41 } 42 }' - "$n" | $pager