If, in the context of a
bike update rows "$SESSION_ID" --outline "$DOC_PATH"`
call, I add the switch:
--attr data-created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
then in the editor I see a badge (unexpected bonus)
In the XML source, however, I see a duplicate data- prefix:
data-data-created="2026-08-30T13:05:05Z"
If I respond by dropping the data- prefix from the --attr name
(data-created → created)
--attr created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
Then no attribute seems to be created at all:
<li id="yWEvmke_xM_02oOuSfvlh" data-type="unordered">
<p>Second sample line</p>
</li>
Not sure if this is unexpected, and I may well be getting something wrong ![]()
(perhaps some missing quoting or escaping ?)
Expand disclosure triangle to view zsh source
#!/bin/zsh
POPCLIP_OPTION_DOCUMENT="~/Documents/Inbox.bike"
POPCLIP_OPTION_ROW="/Inbox"
POPCLIP_TEXT=$'Second sample line\nalpha\nbeta\ngamma'
POPCLIP_OPTION_POSITION="start"
setopt extended_glob
DOC_PATH="${POPCLIP_OPTION_DOCUMENT/#\~/$HOME}"
# Spaces, tabs, newlines trimmed from start and end
TRIMMED_TEXT="${POPCLIP_TEXT##[[:space:]]#}"
TRIMMED_TEXT="${TRIMMED_TEXT%%[[:space:]]#}"
# Any indents preserved, all non-empty lines have markdown bullets
BULLETED_TEXT=$(printf "%s" "$TRIMMED_TEXT" | sed -E 's/^([[:blank:]]*)([^[:blank:]-]+)/\1- \2/')
add_rows() {
# Text of first line, and its session ID, as two lines of text
NAME_SESSIONID=$(printf "%s\n" "$BULLETED_TEXT" |
bike create rows -f - --outline "$DOC_PATH" "$@" |
jaq -r '.[0].text[0].string, .[0].id'
)
FIRST_ROW_TEXT="${NAME_SESSIONID%$'\n'*}"
FIRST_CLAUSE="${FIRST_ROW_TEXT%%[.,;:]*}"
SESSION_ID="${NAME_SESSIONID##*$'\n'}"
# Persistent ID of the document
DOC_ID=$(bike get outline /* --outline "$DOC_PATH" | jaq -r ".persistentId")
BIKE_URL=$(bike update rows "$SESSION_ID" --outline "$DOC_PATH" \
--attr created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--persistent-id @ensure --type unordered |
jaq -r --arg doc "$DOC_ID" '"bike://\($doc)/#\(.[0].row.persistentId)"')
MD_LINK="[${FIRST_CLAUSE}](${BIKE_URL})"
# Placed in various pasteboard items
osascript -l JavaScript -e "
ObjC.import('AppKit');
const pb = $.NSPasteboard.generalPasteboard;
pb.clearContents;
pb.setStringForType('${FIRST_CLAUSE}', 'public.url-name');
pb.setStringForType('${BIKE_URL}', 'public.url');
pb.setStringForType('${MD_LINK}', 'public.utf8-plain-text');
" > /dev/null
echo "$MD_LINK"
echo "$NOW"
}
if [[ ! -f "$DOC_PATH" ]]; then
bike create outline "$DOC_PATH"
fi
if [[ -n "$POPCLIP_OPTION_ROW" ]]; then
ROW_EXISTS=$(bike get outline --refs "$POPCLIP_OPTION_ROW" --outline "$DOC_PATH" --shape flat -o txt)
# The parent heading created if not found
if [[ -z "$ROW_EXISTS" ]]; then
ROW_TEXT="${POPCLIP_OPTION_ROW#/}"
bike create row --outline "$DOC_PATH" --text "$ROW_TEXT"
fi
add_rows --parent "$POPCLIP_OPTION_ROW" --position "$POPCLIP_OPTION_POSITION"
else
add_rows --position "$POPCLIP_OPTION_POSITION"
fi