commit d90a358137063693368fe4905fa334abb6e6a190 (patch)
parent aa47d4304fd7cd46132014c1361fa6c97af074b3
Author: Alex Karle <alex@alexkarle.com>
Date: Thu, 3 Mar 2022 23:31:27 -0500
Add -e switch to open log in $EDITOR
This is just generally a nice feature for more in depth editing
or exploration.
Diffstat:
3 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/README b/README
@@ -4,7 +4,7 @@ NAME
today - what did you do today?
SYNOPSIS
- today [-hi] [-l [NUM]]
+ today [-ehi] [-l [NUM]]
DESCRIPTION
today is a tool for quickly documenting a day's work at the end of
@@ -19,16 +19,20 @@ DESCRIPTION
The options are as follows:
- -h display the help message and exit
+ -e Open the log file in your $EDITOR
- -i initialize the today repository.
+ -h Display the help message and exit
+
+ -i Initialize the today repository.
-l [NUM]
- list the last NUM days-worth of entries, or all if NUM not
+ List the last NUM days-worth of entries, or all if NUM not
given.
ENVIRONMENT
- TODAY_DIR override the default repo location, $HOME/.today.
+ $TODAY_DIR Override the default repo location, $HOME/.today.
+
+ $EDITOR Preferred editor for -e flag.
FILES
$TODAY_DIR Git repository
diff --git a/today b/today
@@ -83,12 +83,13 @@ list() {
}
case "x$1" in
- x) edit ;;
+ x) reqinit && edit ;;
+ x-e) reqinit && ${EDITOR:-vi} "$LOG" ;;
x-i) init ;;
x-l) reqinit && list "$2" ;;
- x-h) die "usage: today [-hi] [-l [NUM]]" ;;
+ x-h) die "usage: today [-ehi] [-l [NUM]]" ;;
*)
[ -n "$1" ] && err "error: unknown option $1"
- die "usage: today [-i]h [-l [NUM]]"
+ die "usage: today [-ehi] [-l [NUM]]"
;;
esac
diff --git a/today.1 b/today.1
@@ -6,7 +6,7 @@
.Nd what did you do today?
.Sh SYNOPSIS
.Nm
-.Op Fl hi
+.Op Fl ehi
.Op Fl l Op Ar NUM
.Sh DESCRIPTION
.Nm
@@ -33,14 +33,17 @@ append-only mindset for recording whatever is top of mind.
.Pp
The options are as follows:
.Bl -tag -width Ds
+.It Fl e
+Open the log file in your
+.Ev $EDITOR
.It Fl h
-display the help message and exit
+Display the help message and exit
.It Fl i
-initialize the
+Initialize the
.Nm
repository.
.It Fl l Op Ar NUM
-list the last
+List the last
.Ar NUM
days-worth of entries,
or all if
@@ -49,9 +52,13 @@ not given.
.El
.Sh ENVIRONMENT
.Bl -tag -width "$TODAY_DIR/log"
-.It Ev TODAY_DIR
-override the default repo location,
+.It Ev $TODAY_DIR
+Override the default repo location,
.Pa $HOME/.today .
+.It Ev $EDITOR
+Preferred editor for
+.Fl e
+flag.
.El
.Sh FILES
.Bl -tag -width "$TODAY_DIR/log"