summaryrefslogtreecommitdiff
path: root/jt.md
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-02 08:53:21 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-02 11:56:56 +0300
commit743d3c65cc69deb9fc4429190288dc8846bcd250 (patch)
tree7a643a7f530cef6b222d3d39a725d64970e4e65a /jt.md
parent5aee9bd2ae4eb9c09e27c002f80d3edf071ebdcb (diff)
downloadjt2-743d3c65cc69deb9fc4429190288dc8846bcd250.tar.gz
feat! support multiple drafts
This changes the command line syntax: subcommands edit and finish now require the draft id. We can change this later so that if there is only one draft, the program picks that one automatically. Also, new entries are 0.md, 1.md, etc, which is not going to be acceptable for real use, but this works minimally.
Diffstat (limited to 'jt.md')
-rw-r--r--jt.md53
1 files changed, 50 insertions, 3 deletions
diff --git a/jt.md b/jt.md
index cbea089..ad40b35 100644
--- a/jt.md
+++ b/jt.md
@@ -26,7 +26,7 @@ until it's finished.
$ jt --dirname ~/Journal init default "My private journal"
$ jt new --tag meta --tag journalling "My first journal entry"
... # text editor is opened so the new entry can be written
-$ jt finish
+$ jt finish 0 first-entry
~~~
@@ -157,11 +157,11 @@ and there is one draft in jrnl
and draft 0 in jrnl contains "Abracadabra"
given an executable script append.sh
-when I run jt2 --editor=./append.sh --dirname=jrnl edit
+when I run jt2 --editor=./append.sh --dirname=jrnl edit 0
then command is successful
and draft 0 in jrnl contains "Open sesame!"
-when I run jt2 --dirname=jrnl finish
+when I run jt2 --dirname=jrnl finish 0 abra
then command is successful
and there is one journal entry in jrnl, at FILE
and journal entry <FILE> contains "Abracadabra"
@@ -175,6 +175,53 @@ set -eux
echo "Open sesame!" >> "$1"
~~~
+## Create two drafts
+
+Verify that we can create two draft entries at the same time.
+
+~~~scenario
+given an installed jt
+
+when I run jt2 --dirname jrnl init default "My test journal"
+then command is successful
+then there are no drafts in jrnl
+then there are no journal entries in jrnl
+
+when I run jt2 --editor=none --dirname=jrnl new "Abracadabra"
+then command is successful
+then there is one draft in jrnl
+then draft 0 in jrnl contains "Abracadabra"
+
+when I run jt2 --editor=none --dirname=jrnl new "Simsalabim"
+then command is successful
+then there are two drafts in jrnl
+then draft 0 in jrnl contains "Abracadabra"
+then draft 1 in jrnl contains "Simsalabim"
+
+given an executable script append.sh
+when I run jt2 --editor=./append.sh --dirname=jrnl edit 0
+then draft 0 in jrnl contains "Open sesame!"
+when I run jt2 --editor=./append.sh --dirname=jrnl edit 1
+then draft 1 in jrnl contains "Open sesame!"
+
+when I run jt2 --dirname=jrnl finish 0 abra
+then command is successful
+then there is one journal entry in jrnl, at FILE
+then journal entry <FILE> contains "Abracadabra"
+then journal entry <FILE> contains "Open sesame!"
+then there is one draft in jrnl
+
+when I run jt2 --dirname=jrnl finish 1 sim
+then command is successful
+then there are two journal entries in jrnl, at FILE1 and FILE2
+then journal entry <FILE1> contains "Abracadabra"
+then journal entry <FILE2> contains "Simsalabim"
+then there are no drafts in jrnl
+~~~
+
+
+
+
# Colophon