From 76114385e7afa78eb7b6c57b1f078b31c2ceb011 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 27 Feb 2025 21:40:17 -1000 Subject: [PATCH] ;bin: edits --- bin/README.md | 3 ++- bin/hledger-jj | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/README.md b/bin/README.md index 542e0398c..014e729c6 100644 --- a/bin/README.md +++ b/bin/README.md @@ -267,6 +267,7 @@ $ hledger git record [MSG] [`hledger-jj`](https://github.com/simonmichael/hledger/blob/master/bin/hledger-jj) provides easy version control for your journal files, using jj (and a git repo). Run it with no arguments for help. This is newer and better than hledger-git and hledger-pijul. +Unlike most shell scripts here, it requires [ysh](https://oils.pub). ```cli $ hledger jj log $ hledger jj status @@ -277,7 +278,7 @@ $ hledger jj commit [MSG] ### hledger-pijul [`hledger-pijul`](https://github.com/simonmichael/hledger/blob/master/bin/hledger-pijul) -provides the same thing using the [pijul](https://pijul.org) version control system.. +provides easy version control for your journal files, using the [pijul](https://pijul.org) version control system.. ```cli $ hledger pijul log $ hledger pijul status diff --git a/bin/hledger-jj b/bin/hledger-jj index fdf3c6df2..a628d45c8 100755 --- a/bin/hledger-jj +++ b/bin/hledger-jj @@ -21,7 +21,7 @@ $ hledger jj diff $ hledger jj commit $ hledger jj c "new txns" $ hledger jj log -- -n5 -$ hledger-jj l -n 5 --stat +$ hledger-jj l -n5 --stat ''' # $ hledger-jj c 'txns' -- -n # commit changes, ignoring any pre-commit hooks @@ -79,6 +79,14 @@ proc ensure_journal_repo() { # ensure that the journal file has a jj/git repo } } +proc status(...opts) { ### [OPTS] - show status of journal files + cd "$DIR" { jj status --color=always @opts @FILES | grep -vE '^Untracked paths:|\?' } +} + +proc diff(...opts) { ### [OPTS] - show unrecorded changes in journal files + cd "$DIR" { jj diff @opts @FILES } +} + proc commit(...opts) { ### [MSG [OPTS]] - record changes to journal files cd "$DIR" { jj file track @FILES @@ -91,14 +99,6 @@ proc commit(...opts) { ### [MSG [OPTS]] - record changes to journal files } } -proc status(...opts) { ### [OPTS] - show status of journal files - cd "$DIR" { jj status --color=always @opts @FILES | grep -vE '^Untracked paths:|\?' } -} - -proc diff(...opts) { ### [OPTS] - show unrecorded changes in journal files - cd "$DIR" { jj diff @opts @FILES } -} - proc log(...opts) { ### [OPTS] - list recorded changes to journal files cd "$DIR" { jj log @opts @FILES } } @@ -109,9 +109,9 @@ if (len(ARGV) < 1) { var args = ARGV[1:] case (ARGV[0]) { /S ('h'('e'('l'('p')?)?)? | '-h' | '-'? '-help') E/ { help } - /S 'c'('o'('m'('m'('i'('t')?)?)?)?)? E/ { setup; commit @args } /S 's'('t'('a'('t'('u'('s')?)?)?)?) ?E/ { setup; status @args } /S 'd'('i'('f'('f')?)?)? E/ { setup; diff @args } + /S 'c'('o'('m'('m'('i'('t')?)?)?)?)? E/ { setup; commit @args } /S 'l'('o'('g')?) ?E/ { setup; log @args } (else) { echo "Unknown command: $[ARGV[0]]"; return 1 } }