feat(frontmatter): --add/--remove list items; --edit keeps existing list type
- --edit splits on commas for tags and for keys already holding a list - --add/--remove change single items, matched by wikilink target, no duplicates - refuse lists with unquoted [[links]] (parsed as nested lists)
This commit is contained in:
1 parent
543ce76207
commit
0f763f98ed
3 files changed
+141
-12
No files matched your search
@@ -231,6 +231,10 @@ onyx frontmatter "note-name" --edit --key "tags" --value "project"
|
||||
onyx frontmatter "note-name" --edit --key "tags" --value "project,urgent"
|
||||
onyx frontmatter "note-name" --edit --key "status" --value "in-progress"
|
||||
|
||||
# Add / remove single items of a list property (repeat --value for several items)
|
||||
onyx frontmatter "note-name" --add --key "participants" --value "[[Haro]]" --value "[[Jeffrey]]"
|
||||
onyx frontmatter "note-name" --remove --key "participants" --value "[[Haro]]"
|
||||
|
||||
# Clear frontmatter values
|
||||
onyx frontmatter "note-name" --clear --key "tags"
|
||||
onyx frontmatter "note-name" --clear --key "date,status,tags"
|
||||
@@ -243,8 +247,14 @@ onyx frontmatter "note-name" --delete --key "date,status,tags"
|
||||
Edits only touch the targeted keys: key order, quoting, accents and long values elsewhere in the
|
||||
frontmatter stay byte-for-byte identical. Values are written the way Obsidian stores them: plain
|
||||
when YAML reads them back unchanged (`done`, `2026-10-19`, `3`), double-quoted otherwise
|
||||
(`"[[Haro]]"`). `tags` takes a comma-separated list, written as a block list. Cleared keys become
|
||||
empty (`status:`), cleared tags `tags: []`.
|
||||
(`"[[Haro]]"`). `tags`, and any key that is already a list in the note, take a comma-separated
|
||||
list with `--edit`, written as a block list. Cleared keys become empty (`status:`), cleared tags
|
||||
`tags: []`.
|
||||
|
||||
`--add` and `--remove` change one list without rewriting it: items are taken whole (no comma
|
||||
splitting) and matched by wikilink target, so `[[Name|Alias]]` and `[[name]]` are the same item.
|
||||
`--add` skips duplicates, creates the list if the key is missing, and turns a text value into the
|
||||
first item. A list holding unquoted `[[links]]` (which YAML reads as nested lists) is refused.
|
||||
|
||||
### Version
|
||||
|
||||
|
||||
Reference in new issue
Block a user