title: diaryx description: CLI frontend author: adammharris audience:
- public
part_of: 'README'
contents:
- 'README' attachments:
- 'Cargo.toml'
- 'build.rs' exclude:
- '*.lock'
Diaryx CLI
A command line interface for the diaryx_core library. Allows command-line journaling.
Installation
Install via cargo:
A Brief Introduction (to the CLI)
Diaryx saves entries as markdown files in a folder, and provides tools for modifying frontmatter properties. It also provides a "workspace" feature for defining relationships between different entries. In this way it is similar to other "knowledge management" tools like Obsidian. But it differs by defining these relationships primarily in the frontmatter in the form of part_of and contents properties.
It distinguishes between "index" files and "content" or "leaf" files. An "index" file describes the contents of a certain area of the workspace. A "content" file is simply a regular file that belongs to a group described by an index file. For example:
> cd
> diaryx
> diaryx
diaryx has initiated a default workspace with a single index file. You can look at it using diaryx open README, which opens the file in your default editor as defined by the $EDITOR environment variable:
title: diaryx
description: A diaryx workspace
contents: []
A diaryx workspace
The frontmatter is the space at the top enclosed with three-hyphen delimiters (---). It describes certain aspects of the file, so it is a kind of readable metadata. Here you see "title" and "description," as well as an empty "contents." These are called properties, and there are many more possible properties you could have in a file, but these are enough to get you started.
To add a file, type diaryx workspace add <filename>.md, replacing <filename> with whatever you want your new file to be called. You can also simply type the letter w instead of workspace as a shortcut, or alias.
> diaryx
If you look in README, a new property has been added:
contents:
- test.md
And you can use diaryx open test to look at the new file. It has a corresponding property:
part_of: README.md
These two properties, contents and part_of, define a hierarchal relationship. You can see it using diaryx workspace info:
> diaryx
The README file has a title, "diaryx," and a description, "A diaryx workspace." The "test" file does not have a title or description, so it just uses the file name.
These contents/part_of relationships can be deeply nested, and don't necessarily need folders to function. You can use it for chapters of a book, phases of a project, recipes in a recipe book, or whatever you like!
From here, you can learn about the tool using --help menus. Try diaryx --help, diaryx workspace --help, or diaryx property --help to learn more about what you can do with Diaryx.
Navigation
Interactively browse your workspace hierarchy with a TUI:
> diaryx
Key Bindings
| Key | Action |
|---|---|
j / ↓ |
Move selection down |
k / ↑ |
Move selection up |
h / ← |
Collapse / Go to parent |
l / → |
Expand / Enter child |
Space / Tab |
Toggle expand/collapse |
J / K |
Scroll preview down/up |
Ctrl+d / Ctrl+u |
Page down/up in preview |
Enter |
Open selected file in $EDITOR |
q / Esc |
Quit |
Navigation Options
diaryx nav- Start from workspace rootdiaryx nav .- Start from current directory's indexdiaryx nav notes/- Start from a specific subdirectory
Workspace Validation
Diaryx can validate your workspace to find broken links and other issues:
> diaryx
)
If issues are found, it reports them:
> diaryx
)
)
)
))
Use --fix to automatically repair issues:
> diaryx
)
Validation Errors
- BrokenPartOf -
part_ofpoints to a non-existent file - BrokenContentsRef -
contentsreferences a non-existent file - BrokenAttachment -
attachmentsreferences a non-existent file
Validation Warnings
- OrphanFile - Markdown file not in any index's
contents - MissingPartOf - Non-index file has no
part_ofproperty - NonPortablePath - Path contains absolute or
./..components - OrphanBinaryFile - Binary file not in any index's
attachments - MultipleIndexes - Multiple index files in same directory
- CircularReference - Circular reference in hierarchy
Exclude Patterns
Use the exclude frontmatter property to suppress warnings for specific files:
exclude:
- "LICENSE.md" # Exact match
- "*.lock" # Glob pattern
Patterns are inherited up the part_of hierarchy.
You can also validate specific files or directories:
> diaryx
> diaryx
> diaryx
Sync
Diaryx can sync your workspace with a remote server for backup and multi-device access:
# Login with magic link authentication
> diaryx
# Verify the magic link token
> diaryx
# Check sync status
> diaryx
===========
)
# Start continuous sync
> diaryx
# Or do one-shot operations
> diaryx > diaryx
Sync Commands
diaryx sync login <email>- Authenticate via magic linkdiaryx sync verify <token>- Complete authenticationdiaryx sync logout- Clear credentialsdiaryx sync status- Show sync statusdiaryx sync start- Start continuous syncdiaryx sync push- One-shot push local changesdiaryx sync pull- One-shot pull remote changesdiaryx sync config- Configure sync settings
roadmap
See the roadmap document here.
License
PolyForm Shield 1.0. Read it here.