aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2025-05-05 14:50:38 -0300
committerSilvio Rhatto <rhatto@riseup.net>2025-05-05 14:50:38 -0300
commitc5327b7577938d5f83fac6a4f9ebd3a5017ef8e7 (patch)
treebf394fe346ede5d0188a8844cd120bc1b3ae8327
parent688634873c7008d2e48d6a93dfa01521a58193e9 (diff)
downloadutils-organization-main.tar.gz
utils-organization-main.tar.bz2
Adds history file support on timew-shellmain
-rwxr-xr-xtimew-shell9
1 files changed, 9 insertions, 0 deletions
diff --git a/timew-shell b/timew-shell
index 2ebbf28..4e00273 100755
--- a/timew-shell
+++ b/timew-shell
@@ -3,6 +3,14 @@
# Timewarrior shell.
#
+# Parameters
+TIMEW_HISTORY="$HOME/.timew_history"
+
+# Load history
+if [ -e "$TIMEW_HISTORY" ]; then
+ history -r $TIMEW_HISTORY
+fi
+
# Shell
function timew_shell {
local last_exit_code="0"
@@ -10,6 +18,7 @@ function timew_shell {
# While a "quit" command isn't entered, read STDIN
while read -rep "$last_exit_code timew> " STDIN; do
history -s "$STDIN"
+ history -a $TIMEW_HISTORY
if [ "$STDIN" == "quit" ] || [ "$STDIN" == "exit" ] || [ "$STDIN" == "bye" ]; then
break