summaryrefslogtreecommitdiff
path: root/yarns/020-basic-workflow.yarn
blob: d86ab0b00acfeefab350f0360c2646b933e91127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Basic Workflow
==============

This chapter explains the basic workflow for adding notes.

Notes are first created as drafts. Normally, when a draft is created,
`jt` invokes the user's preferred editor (`$VISUAL` or `$EDITOR`) on
the draft file. When the user is finished, they exit their editor and
run `jt finish`. The test suite is rigged so that the editor isn't
invoked, because it'd be difficult to control the editor.

    SCENARIO add a simple note
    GIVEN an empty journal in SRC
    AND the time is 2014-11-22 17:30:45
    WHEN I run jt new TITLE-TRÖÖT
    THEN file SRC/drafts/0.mdwn exists
    AND file SRC/drafts/0.mdwn matches title="TITLE-TRÖÖT"

(Note that we use a title with non-ASCII characters to make sure jt
handles that.)

This is where the user would normally use their editor to edit the
draft, and exit the editor when done.

    WHEN I run jt finish
    THEN file SRC/drafts/0.mdwn doesn't exist
    AND file SRC/notes/2014/11/22/title-tr_t.mdwn exists

This is how you create a note, in the simplest case. A more complex
case is when there's more than one draft at a time.

    SCENARIO multiple drafts
    GIVEN an empty journal in SRC
    AND the time is 2014-11-22 17:30:45

    WHEN I run jt new FIRST
    THEN file SRC/drafts/0.mdwn matches title="FIRST"

    WHEN I run jt new SECOND
    THEN file SRC/drafts/1.mdwn matches title="SECOND"

Now, finishing drafts requires naming them explicitly.

    WHEN I try to run jt finish
    THEN it fails

    WHEN I run jt finish 1
    THEN file SRC/drafts/0.mdwn matches title="FIRST"
    AND file SRC/notes/2014/11/22/second.mdwn matches title="SECOND"

We may want to remove a draft without finishing it.

    WHEN I run jt remove 0
    THEN file SRC/drafts/0.mdwn doesn't exist