From: Tucker Johnson Date: Tue, 25 Feb 2025 22:20:43 +0000 (-0500) Subject: scripts X-Git-Url: https://git.newer.systems/?a=commitdiff_plain;h=50887cde63cdccf3d45fa5ec18a45622b67e63b5;p=nvim.git scripts --- diff --git a/scripts/compiler b/scripts/compiler new file mode 100755 index 0000000..2bf6126 --- /dev/null +++ b/scripts/compiler @@ -0,0 +1,51 @@ +#!/bin/sh + +file="${1}" +ext="${file##*.}" +dir=${file%/*} +base="${file%.*}" + +cd "$dir" || exit 1 + +case "$ext" in + [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; + ly) + lytarget="$(getcomproot "${file}" || echo "${file}")" + lilypuddle "${lytarget}" + ;; + mom) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" > "${base}.pdf" ;; + ms) + mstarget="$(getcomproot "${file}" || echo "${file}")" + cd "${mstarget%/*}" + preconv "${mstarget}" | soelim | refer -PS -e -p "$HOME/.local/share/groff/library.txt" | groff -U -ms -kept -dpaper=letter -T pdf > "${mstarget%.*}".pdf ;; + c) cc "${file}" -o "${base}" && "./${base}" ;; + cpp) g++ "${file}" -o "${base}" && "./${base}" ;; + cs) mcs "${file}" && mono "${base}.exe" ;; + go) go run "${file}" ;; + h) sudo make install ;; + java) javac -d classes "${file}" && java -cp classes "${base}" ;; + m) octave "${file}" ;; + md) [ -x "$(command -v lowdown)" ] && \ + lowdown --parse-no-intraemph "${file}" -Tms | groff -mpdfmark -ms -kept -T pdf > "${base}.pdf" || \ + [ -x "$(command -v groffdown)" ] && \ + groffdown -i "${file}" | groff -T pdf > "${base}.pdf" || \ + pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" ;; + org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;; + py) python "${file}" ;; + [rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;; + rs) cargo build ;; + sass) sassc -a "${file}" "${base}.css" ;; + scad) openscad -o "${base}.stl" "${file}" ;; + sent) setsid -f sent "${file}" 2> "/dev/null" ;; + tex) + textarget="$(getcomproot "${file}" || echo "${file}")" + command="pdflatex" + head -n5 "${textarget}" | grep -qi "xelatex" && command="xelatex" + ${command} --output-directory="${textarget%/*}" "${textarget%.*}" && + grep -qi addbibresource "${textarget}" && + biber --input-directory "${textarget%/*}" "${textarget%.*}" && + ${command} --output-directory="${textarget%/*}" "${textarget%.*}" && + ${command} --output-directory="${textarget%/*}" "${textarget%.*}" + ;; + *) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;; +esac diff --git a/scripts/lilypuddle b/scripts/lilypuddle new file mode 100755 index 0000000..2b42e32 --- /dev/null +++ b/scripts/lilypuddle @@ -0,0 +1,7 @@ +#!/bin/sh + +file="${1}" +base="${file%.*}" +gitInfo="branchName = \"$(git branch --show-current)\"\nshortHash = \"$(git show -s --format=%h)\"\nlongHash = \"$(git show -s --format=%H)\"\nsubject = \"$(git show -s --format=%s)\"\ncommitDate = \"$(git show -s --format=%cd)\"" + +sed "2i $gitInfo" $file | lilypond -dno-point-and-click --output="$base" -