summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChloe Kudryavtsev <toast@toast.cafe>2020-04-23 10:36:33 -0400
committerChloe Kudryavtsev <toast@toast.cafe>2020-04-23 10:36:33 -0400
commit2b4826688106e7b4139f4d424de42e8c817ba0dc (patch)
treee3f58231f2b592da78304785dd494ca029b434f9
parentzsh: add docker aliases (diff)
anypaste: add anyminio plugin
Diffstat (limited to '')
-rw-r--r--dot_anypaste-plugins/executable_anyminio31
1 files changed, 31 insertions, 0 deletions
diff --git a/dot_anypaste-plugins/executable_anyminio b/dot_anypaste-plugins/executable_anyminio
new file mode 100644
index 0000000..974d5cb
--- /dev/null
+++ b/dot_anypaste-plugins/executable_anyminio
@@ -0,0 +1,31 @@
+#!/bin/sh
+: "${anyminio_cli:=mc}"
+
+case $1 in
+ check_eligibility)
+ true
+ ;;
+ upload)
+ d=$(date +%Y/%m/%d)
+ path="$anyminio_prefix/$d/$ap_human_name"
+ "$anyminio_cli" cp "$ap_path" "$path"
+ url=$($anyminio_cli ls --json "$path" | jq -r .url)
+ echo >&2
+ echo "Link: $url"
+ echo "Direct: $url"
+ echo
+ ;;
+ get_info)
+ echo '[name]'
+ echo 'Minio'
+ echo '[description]'
+ echo 'Uses minio-client to upload to an arbitrary location (+date and human name). Requires jq to run.'
+ echo '[tags]'
+ echo 'direct'
+ echo 'permanent'
+ echo 'private'
+ echo '[config]'
+ echo 'optional|anyminio_mcli|binary to use as minio-client, defaults to mc'
+ echo 'required|anyminio_prefix|prefix to place data into, e.g target/shared/anypaste'
+ echo 'optional|MC_HOST_target|authorization env to use for *target* if not configured'
+esac