From 2b75799ee374befdc59fff810aaa6f8142e3a83d Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Thu, 6 Feb 2025 22:15:52 +0900 Subject: modified plugins/ai.lua, modified plugins/markdown.lua, created sc-im/, created bin/syncdic, created thesiah/dic --- ar/.local/bin/syncdic | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 ar/.local/bin/syncdic (limited to 'ar/.local/bin') diff --git a/ar/.local/bin/syncdic b/ar/.local/bin/syncdic new file mode 100755 index 0000000..c125f42 --- /dev/null +++ b/ar/.local/bin/syncdic @@ -0,0 +1,33 @@ +#!/bin/sh + +dicfile="${XDG_DATA_HOME:-${HOME}/.local/share}/thesiah/dic" +dest="${XDG_DATA_HOME:-${HOME}/.local/share}/dic" + +[ -d "$dest" ] || mkdir -p "$dest" + +while read -r url; do + [ -z "$url" ] && continue + filename=$(basename "$url") + filepath="${dest}/${filename}" + tarpath=$(echo "$filepath" | sed 's/.zip//;s/.tar.gz//;s/.tgz//;s/.tar.bz2//;s/.tbz2//;s/.tar.xz//;s/.txz//') + + # Download only if the file does not exist + if [ ! -d "$tarpath" ]; then + curl -L "$url" -o "$filepath" + case "$filename" in + *.zip) + unzip -o "$filepath" -d "$dest" + ;; + *.tar.gz | *.tgz) + tar -xzf "$filepath" -C "$dest" + ;; + *.tar.bz2 | *.tbz2) + tar -xjf "$filepath" -C "$dest" + ;; + *.tar.xz | *.txz) + tar -xJf "$filepath" -C "$dest" + ;; + esac + rm -f "$filepath" + fi +done <"$dicfile" -- cgit v1.2.3