Added tags find with support for exact and fuzzy match.
Added support for some tags operations and opening the previous day as a default behavior.
Added functions to show the unique tags present in journal entries.
Script for journal management. Pairs with journal.nvim.
Usage: journal.sh [-t|--template <template>] [-s|--suffix <suffix>]
[-r|--root <dir>] [-tr|--template-root <dir>]
[-nc|--no-color] [--ns|--no-suffix] [-h|--help]
[<command> [sub-command|args]]
Manage journal entries.
Commands:
<no args> Edit today (and open yesterday if it exists)
t|today Edit today (this is the default no-args behavior).
c|commit Commit/push any changes to git.
n|new-journal <dir> Create a new journal with the specified directory.
tags <sub-command> Operate on the tags of the current journal.
Use "--help tags" for more information.
Arguments:
-t|--template <name> Choose the template to use for new entries (default=template).
-s|--suffix <choice> Set the journal file suffix (default=".md"). The dot is required.
-r|--root <dir> Set the journal root directory (default=entries). Should not end in a slash.
-tr|--template-root <dir> Set the template root directory (default=templates). Should not end in a slash.
-nc|--no-color Disable colored output.
-ns|--no-suffix Do not use any suffix.
--git-upstream <value> Set the git upstream, only relevant for the commit command.
--git-branch <value> Set the git branch, only relevant for the commit command.
-h|--help [topic] Display this usage text, or help for a particular topic.
Please note that default values for most arguments can be configured in journal.config.
All edit commands open journal entries in your $EDITOR. Please ensure
the $EDITOR environment variable is set.
Examples:
Edit today: $ journal.sh
Edit today: $ journal.sh today
Commit journal changes: $ journal.sh commit
Create a new journal: $ journal.sh n my-journal
.md
)Just place the script journal.sh into your $PATH
somehow. An
easy way to do this is to add ~/bin
to your $PATH
and add/link this script
there.
This repository provides an installation helper, install.sh
:
~/bin/journal.sh
$ ./install.sh
~/bin/,j
Some people like using a comma to denote custom scripts.
$ ./install.sh -c
$ ./install.sh -n "my_name"
The default journal layout looks like the following:
+ my-journal/
+ entries/
+ 2021/
+ December
- 01.md
- 02.md
+ 2022/
+ July
- 23.md
- 24.md
- 25.md
+ templates/
- template.md
entries
.templates
.journal.sh
supports template files where are used to create new notes. There
are a few relevant command line settings:
-t|--template
: Sets the template that will be used. The default is
template
. This means that when creating a new note (e.g. in journal.sh today
), the script will look for templates/template.md
by default.-s|--suffix
: Sets the suffix that will be used. The default is md
for
Markdown documents. This impacts the format of the new note and also what
template is used. If this is changed to, for example, txt
, journal.sh today
will look for templates/template.txt
.-tr|--template-root
: Sets the directory where journal.sh
will look for
templates. The default is templates
. This is always relative to the project
directory. .
is an acceptable value if desired.journal.sh
can save you a small amount of typing when creating a journal for
the first time. The n
or new-journal
command is the available tool.
journal.sh n my-journal
will create a new directory, my-journal
, with the
default layout or a layout according to your command line arguments. Any
supplied command line arguments will also be used to
configure this journal.
The journal directory must not exist - this command won't apply a journal layout within an existing directory.
journal.config
may exist and live at the root directory of any journal. It
allows users to configure standard settings. The format is that of a bash
script and it will be sourced, if it exists, when journal.sh
is invoked.
journal_root="entries"
template_root="templates"
selected_suffix=".md"
selected_template="template"
selected_git_upstream="origin"
selected_git_branch="main"
journal.sh
is available under the MIT License.