Created
November 6, 2023 18:50
-
-
Save v6ak/d6f4d2dff878c32160ca168f580d3928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Debug output | |
for i in $(seq 10); do echo >> /tmp/debug.log; done | |
echo ====================================================================== >> /tmp/debug.log | |
echo args: "$@" >> /tmp/debug.log | |
cat $ITEM_DATA_JSON >> /tmp/debug.log | |
echo >> /tmp/debug.log | |
env >> /tmp/debug.log | |
# Create the output JSON | |
jq ' | |
{ | |
"commands": [ | |
{ | |
"itemId": .id, | |
"actions": [ | |
{ | |
"tags": [ | |
"tag1", | |
"tag2" | |
], | |
"action" : "add-tags" | |
} | |
] | |
} | |
] | |
} | |
' $ITEM_DATA_JSON | | |
tee -a /tmp/debug.log # also log it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
meta: | |
name: "minimal-addon" | |
version: "$VERSION" | |
triggers: | |
- existing-item | |
- scheduled | |
runner: | |
trivial: | |
enable: true | |
exec: addon.sh | |
options: | |
# If true, the stdout of the program is parsed into a JSON structure | |
# that is interpreted as actions executed by the task that runs the | |
# addon. If the addon runs side effects only, set this to `false` | |
# and the output is ignored. | |
# | |
# It is recommended to use this approach, if possible. It allows | |
# docspell itself to apply any changes and the addon can run | |
# completely isolated. | |
# | |
# Default is true. | |
collectOutput: true | |
networking: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target/addon.zip: docspell-addon.yaml addon.sh | |
# prepare | |
mkdir -p target | |
rm -rf target/unpacked | |
mkdir target/unpacked | |
# addon.sh | |
cp addon.sh target/unpacked | |
chmod +x target/unpacked/addon.sh | |
# docspell-addon.yaml | |
cat docspell-addon.yaml | sed 's#$$VERSION#0.$(shell date +%s)#' > target/unpacked/docspell-addon.yaml | |
# zip | |
env -C target/unpacked zip -r ../addon.zip.new . | |
# commit | |
mv target/addon.zip.new target/addon.zip | |
server: | |
mkdir -p target | |
env -C target python3 -m http.server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you add
at the top, change all your
>> /tmp/debug.log
to>&2
and alsoset -x
at the top, then send me thedebug.log
?