From d2cb34876949f862c89cf8cd61091ce081b67101 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Mon, 21 Oct 2024 22:30:06 -0500 Subject: [PATCH] small changes to termux shortcuts --- .../phone/out-of-tree/shortcuts/make-habit.sh | 2 -- .../out-of-tree/shortcuts/view-habits.sh | 24 +++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/boxes/phone/out-of-tree/shortcuts/make-habit.sh b/boxes/phone/out-of-tree/shortcuts/make-habit.sh index 017ccb8..8b74d7a 100755 --- a/boxes/phone/out-of-tree/shortcuts/make-habit.sh +++ b/boxes/phone/out-of-tree/shortcuts/make-habit.sh @@ -1,5 +1,3 @@ -set -x - register_habits=$(ls ~/pdbs/ | grep '\.habit$' | fzy) diff --git a/boxes/phone/out-of-tree/shortcuts/view-habits.sh b/boxes/phone/out-of-tree/shortcuts/view-habits.sh index a12cdbf..a22d6b0 100755 --- a/boxes/phone/out-of-tree/shortcuts/view-habits.sh +++ b/boxes/phone/out-of-tree/shortcuts/view-habits.sh @@ -9,23 +9,23 @@ today=$(date "+%m/%d/%Y") # $1 -- habit filename show_past_habit () { - printf "%55s =========\n" "$1" - donein5days=$(grep -c "$day5" ~/pdbs/$1.habit ) - donein4days=$(grep -c "$day4" ~/pdbs/$1.habit ) - donein3days=$(grep -c "$day3" ~/pdbs/$1.habit ) - donein2days=$(grep -c "$day2" ~/pdbs/$1.habit ) - donein1days=$(grep -c "$day1" ~/pdbs/$1.habit ) - donetoday=$(grep -c "$today" ~/pdbs/$1.habit) + printf "%25s =========\n" "$1" + donein5days=$(grep -c "$day5" "$HOME/pdbs/$1") + donein4days=$(grep -c "$day4" "$HOME/pdbs/$1") + donein3days=$(grep -c "$day3" "$HOME/pdbs/$1") + donein2days=$(grep -c "$day2" "$HOME/pdbs/$1") + donein1days=$(grep -c "$day1" "$HOME/pdbs/$1") + donetoday=$(grep -c "$today" "$HOME/pdbs/$1") - printf "%10s %10s %10s %10s %10s %10s\n%10s %10s %10s %10s %10s (today)%3s\n\n" \ + printf "%.5s %.5s %.5s %.5s %.5s %.5s\n%5s %5s %5s %5s %5s %5s\n\n" \ "$day5" "$day4" "$day3" "$day2" "$day1" "$today" \ "$donein5days" "$donein4days" "$donein3days" \ "$donein2days" "$donein1days" "$donetoday" } -habits=$(ls ~/pdbs | grep '\.habit$' | sed 's/\.habit$//g') -IFS=' -' -for i in "$habits"; do +habits=$(ls ~/pdbs | grep '\.habit$') +for i in $habits; do show_past_habit "$i" done + +read THROWAWAY