aboutsummaryrefslogtreecommitdiff
path: root/README.org
blob: 3093f19c470a61f1325feae25937f4adfa655c37 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
* Stitch - Note Composer

Stitch is a minimal grep-based CLI tool for composing notes.  It is
built around the idea of writing notes separately and then using tags
to compose these notes together.

Stitch does not have any opinion about which file format you use for
file capturing, use org, markdown, whatever you want. You can also
customize the grep command to speed up performance.

Stitch tries to have few dependencies, and stick only to coreutils by
default

Stitch limits itself only to note composing. For capturing notes, you
will have to set up your own system.

** AIMS

- Single binary
- Minimal
- Work with any file format

** CREDIT

Stitch is based and largely a stripped down copy of the note composing
system of Howm for Emacs.

** INSTALLATION

Chmod +x the binary and put in PATH.

Set the environment variables:

STICH_DIRECTORY
STICH_GREP_CMD (default "grep")
STITCH_HEADLINE_PATTERN_REGEXP (default "^\\* ")
STITCH_HEADLINE_PATTERN (default "* ")
STITCH_TAG_PATTERN (default ":[a-z-]+:", matches :a-tag:)
STITCH_TODO (default "* TODO")
STITCH_TODO_REGEXP (default "^\\* TODO")
STITCH_DONE (default "* DONE")
STITCH_DONE_REGEXP (default "^\\* DONE")

** SPEED UP

Stitch uses grep by default. As your notes grow, this will 
become rather slow. To speed it up, you can replace it grep with ugrep.

** DEVELOPMENT

To set up the project, easiest way is to just install Nix, direnv and
enable nix flakes. Then to compile:

dune build

And to run:

dune exec -- stitch


** RECIPES

- Building a journaling system
You can build a basic capture command using $EDITOR and date command:

#+begin_src sh
export STITCH_DIRECTORY=/home/me/notes
function capture {
  JRNL="$STITCH_DIRECTORY/$(date +'%y-%m-%d.%H:%M.%S').org"
  echo '*  :journal:' >> $JRNL 
  $EDITOR "$JRNL" +1:3 
}

function todo {
  JRNL="$STITCH_DIRECTORY/$(date +'%y-%m-%d.%H:%M.%S').org"
  echo '* TODO  ' >> $JRNL 
  kak "$JRNL" +1:8 -e "execute-keys i"
}

alias jrnl='stitch -t :journal:'
#+end_src

and then you can find your journal entries, automatically sorted by
creation date with stitch and the journal tag:

alias jrnl="stitch -t journal"

* KNOWN ISSUES

- ugrep doesn't correctly handle ordering, meaning that if you sort by
  modified date, it doesn't behave correctly. I've waited with implementing it until I've resolved that issue
  


* Author

Marc Coquand, 2024

* LICENSE

BSD-3-Clause