feat(memo): replace custom omemo with mattn/memo template#80
Merged
Conversation
The omemo bash script duplicated functionality already provided by
mattn/memo (already installed via run_once_install-linux-packages).
Replace it with a memotemplate file that produces the same YAML
frontmatter, and bring ~/.config/memo/config.toml under chezmoi
management so the template is wired up declaratively.
- Delete dot_local/bin/omemo
- Add private_dot_config/memo/config.toml (memotemplate pointing to
template.md; existing values preserved with ~/ prefix)
- Add private_dot_config/memo/template.md (Go text/template with
{{.Title}} and {{.Date}})
Address two issues raised on the previous commit:
- Hardcoded `~/Documents/ob_edgissa/memo/_posts` leaked a personal
vault name into the public dotfiles repo. Parameterize via a new
chezmoi template variable `memo_dir` (prompted on init, default
`Documents/memo/_posts`). Personal value is stored in the user's
out-of-repo `~/.config/chezmoi/chezmoi.yaml`.
- Switch `~/` prefix to `${HOME}/` for portable home expansion;
mattn/memo expands env vars at runtime.
Side effect: exclude `.chezmoi.yaml.tmpl` from the
`chezmoi-template-check` pre-commit hook — it uses init-only
functions (e.g. `promptStringOnce`) that plain
`chezmoi execute-template` does not recognize, so the hook would
otherwise fail on any change to that file.
`promptStringOnce` opens /dev/tty unconditionally and fails in GitHub Actions runners (no TTY). Wrap the new memo_dir prompt in the same `if env "CI"` pattern used by op_account, so CI falls through to the default path without prompting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dot_local/bin/omemo(custom shell script that duplicated mattn/memo's functionality).~/.config/memo/under chezmoi management.memo_dirso the public repo no longer hardcodes a personal vault name.Changes
dot_local/bin/omemoprivate_dot_config/memo/template.md{{.Title}},{{.Date}}) producing the same YAML frontmatteromemodidprivate_dot_config/memo/config.toml.tmplmemodirandmemotemplateuse${HOME}and{{ .memo_dir }}.chezmoi.yaml.tmplmemo_dirdata var (defaultDocuments/memo/_posts).pre-commit-config.yaml.chezmoi.yaml.tmplchezmoi execute-templatewhich doesn't knowpromptStringOnceWhy this approach
mattn/memois already installed viarun_once_install-linux-packages.sh.tmpl:59. Itsmemotemplateconfig supports the exact use case theomemoscript was solving.mattn/memoREADME,memodir/memotemplateaccept${HOME}and~/— using${HOME}makes the path portable across machines without hardcoding/home/<user>or/Users/<user>.ob_edgissais personal; moving it to a chezmoi prompt keeps it out of git while letting first-timechezmoi initset it up.Post-merge steps (for me)
After merging:
A separate cleanup is needed: branch
fix/omemo-executable-prefixwas an earlier (now superseded) attempt to keep the script. It should be deleted withgit push origin --delete fix/omemo-executable-prefixafter this PR is merged.Test plan
make lintpassespre-commit run --all-filespasses for changed fileschezmoi execute-template < private_dot_config/memo/config.toml.tmplrenders cleanly with default and aftermemo_diris setmemo new "test"produces a markdown file with the expected frontmatter at\$memo_dir