Setting list property values using the CLI

What I’m trying to do

Set a property’s value to be a list of at least two items using property:set within the CLI.

Things I have tried

Setting value= to every reasonable combination of whitespace, bullets, and so on that I could think of.

I’ve checked the user guide and found only this snippet with no example:
”””
property:set

Set a property on a file (default: active file).

name=<name>                                    # (required) property name
value=<value>                                  # (required) property value
type=text|list|number|checkbox|date|datetime   # property type
file=<name>                                    # file name
path=<path>                                    # file path

“““

You should be able to pass the value(s) of the list as a json array (["item 1", "item 2"]) to the value parameter :blush: .

E.g.: in zsh: Targeting specifically Obsidian’s sandbox vault, this adds a list type of key (simply named list :sweat_smile: ) to Start here.md storing the values ["value 1", "value 2"]

 % obsidian vault="Obsidian Sandbox" property:set name=list value='["value 1", "value 2"]' type=list path="Start here.md"
Set list: ["value 1", "value 2"]

… which Obsidian automatically parse/reformat as a classical YAML list in Source mode :blush:

---
list:
  - value 1
  - value 2
---

the square brackets didn’t work, but simply separating the items with commas did! sort of kicks the can because now i don’t know how to add commas to the value, but that’s a concession i am willing to make. thanks for the help!

1 Like