provide elemental TW interactions

This commit is contained in:
fred 2024-04-21 22:55:49 +02:00
parent 2b93275ec4
commit b36cc445e1
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#!/bin/bash
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
TW="$1"
[[ ! -s $TW ]] && echo "no TW found $TW" && exit 1
TITLE="$2"
[[ -s $TITLE || $TITTLE == "" ]] && echo "need a $TITTLE" && exit 1
tiddlywiki --load $TW \
--deletetiddlers "${TITLE}" \
--output ~/.zen/tmp --render "$:/core/save/all" "${MOATS}.html" "text/plain"
[[ -s ~/.zen/tmp/${MOATS}.html ]] \
&& cp ~/.zen/tmp/${MOATS}.html ${TW} \
&& rm ~/.zen/tmp/${MOATS}.html \
|| { echo "ERROR - CANNOT IMPORT ${TIDDLER} in ${TW} - ERROR" && exit 1 }
exit 0

View File

@ -0,0 +1,18 @@
#!/bin/bash
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
TW="$1"
[[ ! -s $TW ]] && echo "no TW found $TW" && exit 1
TIDDLER="$2"
[[ ! -s $TIDDLER || $TIDDLER == "" ]] && echo "need a $TIDDLER json file" && exit 1
tiddlywiki --load ${TW} \
--import ${TIDDLER} 'application/json' \
--output ~/.zen/tmp \
--render "$:/core/save/all" "${MOATS}.html" "text/plain"
[[ -s ~/.zen/tmp/${MOATS}.html ]] \
&& cp ~/.zen/tmp/${MOATS}.html ${TW} \
&& rm ~/.zen/tmp/${MOATS}.html \
|| { echo "ERROR - CANNOT IMPORT ${TIDDLER} in ${TW} - ERROR" && exit 1 }
exit 0

9
RUNTIME/tw/readme.md Normal file
View File

@ -0,0 +1,9 @@
provide elemental TW interactions
* import_tiddler.sh TW TIDDLER
https://talk.tiddlywiki.org/t/how-to-add-extract-modify-tiddlers-from-command-line-to-do-ipfs-media-transfer/4345?u=papiche
* delete_tiddler.sh TW QUERY
https://talk.tiddlywiki.org/t/how-to-filter-and-delete-multiple-tiddlers/4950
add more complex queries ....