/comp (15d2d1cd7b083c7d4120e7902d9cba9616afe151) (1743 bytes) (mode 100755) (type blob)
#!/bin/ksh
# This script will compile or run another finishing operation on a document. I
# have this script run via vim/emacs.
#
# tex files: Compiles to pdf, including bibliography if necessary
# md files: Compiles to pdf via pandoc
# config.h files: (For suckless utils) recompiles and installs program.
# all others: run `sent` to show a presentation
oridir=$(pwd)
file=$(readlink -f "$1")
dir=$(dirname "$file")
dirname=$(echo "$dir" | sed "s|/.*/||g")
base="${file%.*}"
shebang=$(sed -n 1p $file)
cd $dir
# && mv "$base".pdf "$dir"/pdfs
shebangtest() {
case "$shebang" in
\#\!*) time "$file" ;;
*) sent "$file" 2>/dev/null & ;;
esac
}
javarun() {
#probably will forever be a work in progress because I dont ever plan on using this abomination of a language again.
#that means I cant test it.
classname=$(grep "class " "$file" | sed "s/public class //g; s/class //g; s/class//g; s/{//g;1q")
javac "$file"
java "$classname"
}
lexer() {
lex "$file"
c mk lex.yy.c && mv lex.yy "$base" && rm lex.yy.c
}
case "$file" in
*\.rmd) echo "require(rmarkdown); render('$file')" | R --vanilla && mv "$base".pdf "$dir"/pdfs ;;
*\.ms) groff "$file" -ms -eRt -T pdf > "$base".pdf ;;
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
*config.h) doas make clean install ;;
*\.c) c run "$file" ;;
*\.cpp) c -c clang++ run "$file" ;;
*\.cc) c -c clang++ run "$file" ;;
*\.l) lexer ;;
*\.zig) time zig run "$file" ;;
*\.s) as -o "$base".o "$file" && ld -o "$base" "$base".o && time "$base" ;;
*\.java) time javarun ;;
*\.hs) ghc "$file" && time "$base" ;;
*\.py) time python "$file" ;;
*\.go) time go build; strip "$dir/$dirname"; "$dir/$dirname" ;;
*) shebangtest ;;
esac
cd $oridir
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
35149 |
f288702d2fa16d3cdf0035b15a9fcbc552cd88e7 |
COPYING |
100755 |
blob |
628 |
aea31675501c3d82c411eb99ff64d69446a550a0 |
INSTALL |
100644 |
blob |
2429 |
d98741b40437761e17e1fa301e70952d8ff98387 |
README |
100755 |
blob |
2477 |
b9a622397ba215256c724bdadc12e6b161cce6b8 |
c |
100644 |
blob |
4161 |
d3c21fdd338bf33819184988562e3961f7883484 |
clp.c |
100755 |
blob |
1743 |
15d2d1cd7b083c7d4120e7902d9cba9616afe151 |
comp |
100644 |
blob |
807 |
59c452396f94f50dbe567bc19530fd386a52b652 |
echo.c |
100755 |
blob |
695 |
a6ca102f88d4643c962a52dc416f1e7a159962b9 |
exho |
100755 |
blob |
783 |
5a9e33def49890e1fbbb5af04d35a39e078f17dd |
ins |
100644 |
blob |
979 |
89b230aabe515c66e967be21a4d9dff3ac5248da |
nl.l |
100644 |
blob |
1920 |
97b9e917313c878d8f4899893143c320b779de3f |
sc.c |
100644 |
blob |
1127 |
c105483de17bc09fe24e3b0fecfbce024fa380b0 |
spng.c |
100644 |
blob |
1178 |
1433a0105fd7a07e7ede04214e26552241f36b64 |
tee.c |
100644 |
blob |
2084 |
7c05702000203c8061b07e7238dc0b5049b91ca6 |
wc.c |
100644 |
blob |
796 |
7359238b347bc985adc97e744cde0f8aa2ee6fbc |
yes.c |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/spicylord/clutils
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/spicylord/clutils
Clone this repository using git:
git clone git://git.rocketgit.com/user/spicylord/clutils
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main