-
-
Notifications
You must be signed in to change notification settings - Fork 65
Internals
This document delves into the internals of dijo
.
After its first run, dijo
creates two files on your file
system, one to record habit data, habit_record.json
, and
one to record auto-habit data, habit_record[auto].json
.
They are saved in a human-readable format: JSON (a lot of
work went into this). These files are saved in different
directories based on your operating system:
- GNU/Linux:
$XDG_DATA_HOME/dijo/*.json
- MacOS:
$HOME/Library/Application Support/rs.nerdypepper.dijo/*.json
- Win10:
{FOLDERID_RoamingAppData}\nerdypepper\dijo\data\*.json
Making changes to these files while dijo
is running, is
not recommended (dijo
will overwrite your changes on save).
dijo
will not run on your computer if it can't find your
home directory.
The general structure of a habit is as follows:
type :: String,
name :: String,
goal :: HabitType,
auto :: bool,
stats :: Map<Date, HabitType>
HabitType
is the type of data to be tracked and it is a
bool
for bit-type habits and a u32
for counting habits.
dijo
sets up a file watcher (in the interactive mode), and
watches habit_record[auto].json
for changes. When changes
are made to this file via dijo -c
or equivalent, the
interactive mode receives an update. However, the change is
not reflected immediately because of dijo
's event based
redrawing. You may force a redraw, and thereby update auto
habits by pressing any button on the keyboard.