Remove modified logic
This was only really necessary for knowing which files to commit to git,
but since files are now only committed in the 'new' and 'sync' commands
it's no longer needed.
Refactor backlinks logic
Instead of parsing backlinks when getting the list of Zettels, only find
backlinks when they are actually being written. Also use a HashMap to
represent backlinks instead of a pointer to the Zettel object, which is
Only create git commits on 'sync' and 'new' commands
Link to libc
Apparently, Zig fails to detect the dependency on libc
if not told explicitly.
Move all committing logic into commitZettels function
Increase buffer size for strftime
Print new Zettel name when stdout is not a tty
Simplify 'show' command logic
Remove hasExtension function in favor of mem.endsWith
Write backlinks at bottom of file
Before, backlinks would be written at the end of the file but before the
last "---", if it existed. This was because a "---" was used to begin
the references section in notes. However, it is much easier and
generally more readable to simply put references under their own "##
References" section and keep backlinks at the bottom.
Update 'show' command aliases in completion files
Make patterns match on zettel contents
Instead of just matching on the filename, id, or title, make command
line patterns match anywhere in the zettel. This reduces the necessity
of shell completions and also removes the need for the 'search' command
(since 'zet ls PATTERN' is now identical to 'zet search PATTERN').
Add TtyWriter to display colored output to terminal
Commit modified files after 'open' command
Few more minor updates to bash completion
Reduce redundancy in command definitions
Before, adding a new command required changes in 3 or 4 different
places. Now, adding a new command is as simple as defining in the
command in the appropriate file under the cmd/ folder and making the
Command data structure public, then just adding the @import statement to
the 'commands' array.
Refactor common functions
Most of the heavy lifting now happens in the zettel.zig file itself and
most of the cmd/*.zig files just act as front-ends to these functions
(e.g. backlinks, reading, opening, etc.). This allows most of the
complexity to exist in a single place and the command functions
themselves to be nicely isolated.
Improve shell completion files
Bash completions now match anywhere in the string, not just at the
prefix. This means you can enter something like
zet o 'substring of filename'<TAB>
And it will expand to the full filename (this is also how fish
completion works by default and it's much better).