Spaces and items
Commands take the space first (its name or ID), then the item as TYPE/ID.
Pick types that describe what the item is: note, contact, event,
recipe. Search and the timeline understand a few common fields, listed
below.
List and read
Section titled “List and read”hs ls notes # what is in the space "notes"hs ls notes note # only noteshs ls notes --all # everything, page by pagehs get notes note/shoppinghs get photos file/3f2a… -o beach.jpghs put creates or replaces an item from a file, or from standard input:
echo '{"title": "Shopping", "text": "milk, eggs"}' | hs put notes note/shoppinghs put notes recipe/bread bread.mdThe media type comes from the file name, or JSON when there is none; set it
with --media-type. To change an item safely, --new fails if it already
exists, and --if-match ETAG fails if someone changed it since you read it.
Two easier ways to change an item:
hs edit notes note/shopping # opens $EDITOR; a new ID starts emptyhs patch notes note/shopping '{"done": true}' # change some fields of a JSON itemhs patch takes a JSON merge patch: fields you give are set, fields set to
null are removed, the rest stay as they are.
Fields that search and the timeline understand
Section titled “Fields that search and the timeline understand”{ "title": "Weekend", "text": "A walk in the park with Mum", "time": "2024-05-01T09:30:00Z", "place": { "lat": 31.23, "lon": 121.47 }, "links": [{ "rel": "with", "href": "person/mum" }]}title(orname) andtextare searched.timeplaces the item on the timeline.placeletshs nearfind it.linksconnect it to people, places and other items, forhs related.
Files and photos
Section titled “Files and photos”hs upload photos IMG_0001.jpg IMG_0002.jpgEach file becomes a file/… item named by its content, so uploading the
same file twice changes nothing. For photos, the time, place and camera are
read from the EXIF data, and a thumbnail is made for JPEG and PNG.
Remove
Section titled “Remove”hs rm notes note/shoppinghs rm notes note/shopping --eraseA plain rm deletes the item but keeps its history, like any other change.
--erase also removes its earlier versions from the logs of every member
who follows the space. What someone already copied cannot be taken back.