This commit is contained in:
2025-09-11 17:18:20 -04:00
parent 7c9858f113
commit 2702b9f736
7 changed files with 4 additions and 3 deletions

View File

@@ -1,36 +0,0 @@
#!/bin/sh
# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler
# This script will compile or run another finishing operation on a document. I
# have this script run via vim.
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extension or shebang.
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" ;;
c) cc "${file}" -o "${base}" && "./${base}" ;;
cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
go) go run "${file}" ;;
h) sudo make install ;;
java) javac -d classes "${file}" && java -cp classes "${base}" ;;
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}" ;;
py) python "${file}" ;;
rs) cargo build ;;
ty) typst compile "$file" ;;
*) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;;
esac

View File

@@ -1,25 +0,0 @@
#!/bin/sh
pkgs="$@"
installer="echo \"error: something went wrong\" ; exit 1"
check() {
command -v "$1" >/dev/null 2>&1
}
if check xbps-install; then
installer="sudo xbps-install -Syu"
elif check pacman; then
installer="sudo pacman -Syu"
elif check apt; then
installer="sudo apt install -y"
elif check dnf; then
installer="sudo dnf install -y"
elif check brew; then
installer="brew install"
else
echo "error: could not find package manager." ; exit 1
fi
$installer $pkgs && echo "done." && exit 0
exit 1

View File

@@ -1,25 +0,0 @@
#!/bin/sh
pkgs="$@"
installer="echo \"error: something went wrong\" ; exit 1"
check() {
command -v "$1" >/dev/null 2>&1
}
if check xbps-remove; then
installer="sudo xbps-remove"
elif check pacman; then
installer="sudo pacman -R"
elif check apt; then
installer="sudo apt remove"
elif check dnf; then
installer="sudo dnf remove"
elif check brew; then
installer="brew remove"
else
echo "error: could not find package manager." ; exit 1
fi
$installer $pkgs && echo "done." && exit 0
exit 1