From 6712f8b1dbeb783fc896d5d542e01666b6168318 Mon Sep 17 00:00:00 2001 From: dozens Date: Sat, 3 Feb 2024 14:50:24 -0700 Subject: [PATCH] add Date to update procedure sometimes i add the session log after the session has happened! --- README.md | 2 +- bin/cli.sh | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index beb6bdf..e010eec 100644 --- a/README.md +++ b/README.md @@ -94,11 +94,11 @@ See `justfile` for more examples - [x] Add types/enums - [x] ~~tui?~~ run `just new` - [x] add Update to CLI +- [x] add Date to update menu. sometimes i add the session log after the session has happened! - [ ] CLI flags mode - [ ] refactor edit/update search functions - [ ] rename Update to Log or Session Log? - [ ] change Recent Games from 'recently created' to 'recently updated' ? -- [ ] add Date to update menu. sometimes i add the session log after the session has happened! ## Resources diff --git a/bin/cli.sh b/bin/cli.sh index 02a6dc2..16912d4 100644 --- a/bin/cli.sh +++ b/bin/cli.sh @@ -13,6 +13,8 @@ db="db/games.rec" + + function main_menu { cat< " selection; } + + function new_game () { read -p "System: " system read -p "Module: " module @@ -68,6 +72,8 @@ recins $db --verbose -t Game \ gamemenutmpl="{{Id}}. {{Module}} ({{System}}) " + + function edit_game () { id="$1" shift @@ -87,17 +93,22 @@ case $selection in esac } + + function update () { id="$1" shift +read -p "Date> " created tmp=$(mktemp) $EDITOR "$tmp" Text=$(< "$tmp") -recins --verbose $db -t Update -f Game -v "$id" -f Text -v "$Text" +recins --verbose $db -t Update -f Game -v "$id" -f Text -v "$Text" -f Created -v "$created" recsel $db -t Update -q "$Text" main_menu } + + function recent_games_update () { count=`recsel -t Game $db -c` recent="$((count - 7))" @@ -111,6 +122,8 @@ case $id in esac } + + function search_games_update () { read -p "Query> " q recsel $db -t Game -i -q "${q}" | recfmt "${gamemenutmpl}" @@ -123,6 +136,8 @@ case id in esac } + + function recent_games () { count=`recsel -t Game $db -c` recent="$((count - 7))" @@ -136,6 +151,8 @@ case $id in esac } + + function search_games () { read -p "Query> " q recsel $db -t Game -i -q "${q}" | recfmt "${gamemenutmpl}" @@ -148,6 +165,8 @@ case id in esac } + + function update_menu () { cat<