Micron Document
rethinking aliases

I had an earlier note about using fzf for searching my notes. I keep forgetting the aliases, so I'm going to bundle them with a T383838justfile and create just one alias with a bunch of arguments.

Background

I have my notes in a very shallow hierarchy in a git repository. There is a notes sub directory that contains all of my notes. Everything that is a note is in that notes directory and the file names are based on the time when the file was created.

At the same depth as the notes level, I have a directory that gets generated by a python script when I save a note. That directory contains a bunch of directories full of symbolic links that point into my notes directory. This gives me a tags view, a titles view, and a couple of views of backlinks.

So my notes repository looks like this:

notes (everything)
meta
├── backlinks-files
│   └── …
├── backlinks-titles
│   └── …
├── tags
│   ├── 3ds
│   │   ├── Bought a new 3DS LL (JPN).md -> notes/2023-08-19-09-14-21.mu
│   │   └── …
│   ├── asahi
│   │   ├── graphics fail on asahi.md -> notes/2022-03-23-16-58-41.mu
│   │   └── NixOS Asahi on MBP.md -> notes/2024-03-21-07-16-54.mu
│   ├── atoms
│   │   ├── 1959 to 2008 linoleic acid levels in human subjects.md -> notes/2024-01-12-07-39-17.mu
│   │   └── …
│   └── …
└── titles
├── 1959 to 2008 linoleic acid levels in human subjects.md -> notes/2024-01-12-07-39-17.mu
├── abook is broken.md -> notes/2022-12-20-20-56-44.mu
├── about my notes.md -> notes/2022-12-06-06-18-01.mu
├── …
├── 生词:适合.md -> notes/2023-09-09-20-38-40.mu
└── 这样.md -> notes/2023-08-24-09-13-10.mu

I use a combination of T383838bat and T383838rg whenever I want to search my notes, unless I happen to be in (neo)vim and then I use Telescope -- which is backed by T383838rg. I also make use of Neo-Tree and can toggle the preview pane. It makes for a somewhat busy UI, but it's colorful and I can toggle zen mode to dismiss the frilly bits.

Not that long ago, I was reading the man page for T383838fzf and saw it had all kinds of cool preview features and multi select, and what-not, so I created some aliases for searching my notes. In addition to the previously mentioned utilities, I also made use of T383838bemenu to pop up fuzzy finding menus for searching in my notes by tags or titles. It had some fragile bits because it parsed the tags and titles out of the notes directly, but not in a very standard way. The symbolic links were a first step in replacing elements of that script.

When I saw that T383838fzf could make a very Telescope-like interface, I created aliases to search by tags and titles in there, too. But apparently the aliases are too hard for me to remember.

Also not that long ago, someone pointed me to an article about using a T383838justfile to handle command-line argument parsing to simplify creating command-line helpers. I've had trouble finding the link, if I made a note about it, I didn't tag it. But essentially you create a T383838justfile, stick it somewhere convenient, and create an alias to invoke. Then add targets to that just file that do whatever, and you can use the alias.

First Iteration

So I have created a T383838justfile. I put it in T383838~/notes-cli/justfile and I have an alias defined:

alias notes='just --justfile /home/stephen/notes-cli/justfile'

Some of the content of that T383838justfile:

T282828
Te6edf3export Te6edf3REDTb4b4b4:Tff7b72=Ta5d6ff"\\e[0;31m"
Te6edf3export Te6edf3RSTTb4b4b4:Tff7b72=Ta5d6ff"\\e[0m"
Te6edf3export Te6edf3BOLD_WHITETb4b4b4:Tff7b72=Ta5d6ff"\\e[1;37m"

Te6edf3export Te6edf3WORKDIRTb4b4b4:Tff7b72=Te6edf3invocation_directoryTb4b4b4(Tb4b4b4)

Te6edf3export Te6edf3FZF_PBGTb4b4b4:Tff7b72=Ta5d6ff"#333333"
Te6edf3export Te6edf3FZF_BGTb4b4b4:Tff7b72=Ta5d6ff"#222222"
Te6edf3export Te6edf3FZFARGSTb4b4b4:Tff7b72=Ta5d6ff"-m --border --preview \"Te6edf3bat T8b949e--color=always {}\" --color bg:${FZF_BG},preview-bg:${FZF_PBG} --bind \"enter:become(${EDITOR} {+})\""

Te6edf3export Te6edf3DATE_FMTTb4b4b4:Tff7b72=Ta5d6ff"+%Y-%m-%d-%H-%M-%S"

help:
#!/usr/bin/env bash
echo -e "${BOLD_WHITE}Notes Helper${RST}"
echo -e "${BOLD_WHITE}============${RST}"
echo "This is a convenience script for making note management fun and easy. Or at least easier."
echo
echo "As long as there is a notes directory in the current directory this script can help with searching and creating new notes."
just --list

[private]
@error msg:
echo -e "${RED}error${RST}: ${BOLD_WHITE}{{msg}}${RST}">&2
exit 1

Tff7b72[Te6edf3privateTff7b72]
Tff7b72check:
#!Tff7b72/Te6edf3usrTff7b72/Te6edf3binTff7b72/Te6edf3env Te6edf3bash
Tff7b72if Tff7b72[Te6edf3 ! -d "${WORKDIR}"/notes Tff7b72] Tb4b4b4; Tff7b72then
Te6edf3just Te6edf3error Ta5d6ff"This doesn't look like a notes repository."
Te6edf3fi

Tff7b72[Te6edf3no-cdTff7b72]
Te6edf3@ls: Tff7b72check
Te6edf3ls Tff7b72-Te6edf3lart Te6edf3notes

Tff7b72[Te6edf3no-cdTff7b72]
Te6edf3@fls: Tff7b72check
Te6edf3fzf {{Te6edf3FZFARGS}} T8b949e--walker-root notes

Tff7b72[Te6edf3no-cdTff7b72]
Te6edf3@ts: Tff7b72check
Te6edf3fzf {{Te6edf3FZFARGS}} T8b949e--walker-root meta/titles

Tff7b72[Te6edf3no-cdTff7b72]
Te6edf3@tags: Tff7b72check
Te6edf3fzf {{Te6edf3FZFARGS}} T8b949e--walker-root meta/tags

Tff7b72[Te6edf3no-cdTff7b72]
Te6edf3@links: Tff7b72check
Te6edf3fzf {{Te6edf3FZFARGS}} T8b949e--walker-root meta/backlinks-titles

Te6edf3@new: Tff7b72check
Ta5d6ff"${EDITOR}" Te6edf3notesTff7b72/Ta5d6ff"$(date "${Te6edf3DATE_FMT}Ta5d6ff".mu)"


Then if I call T383838notes I see the following:

[?2004l
Notes Helper
============
This is a convenience script for making note management fun and easy. Or at least easier.

As long as there is a notes directory in the current directory this script can help with searching and creating new notes.
Available recipes:
fls # List the last few notes that were edited (with fzf!)
help # Show's (this) help info
links # Search backlinks with fzf
ls # List the last few notes that were edited
new # Creates a new note in a notes directory
tags # Search tags with fzf
ts # Search titles with fzf

If I use the T383838notes ts command I can search for a title. Here's an image showing a search for the term Enthymeme.


So...

While it seems trivial that I have replaced some aliases with another alias, now I can easily get a reminder for what each alias does. I think it's a more convenient package. But I guess I'll find out if I end up using/remembering it. I can also hang scripts off it and use it for other note related stuff. Like common pandoc reformatting or whatever else comes to mind that might be useful when I'm doing other things.

Tags: index, cli

Tags
Navigation





created: 2025-08-08

(re)generated: 2026-07-17