1
0
Fork 0

compiler compiler script changes

This commit is contained in:
Luca Bilke 2022-09-30 13:11:15 +02:00
parent 46a4208ad1
commit 34a8fd84c2
3 changed files with 18 additions and 9 deletions

View File

@ -8,7 +8,6 @@
#
# Note that .tex files which you wish to compile with XeLaTeX should have the
# string "xelatex" somewhere in a comment/command in the first 5 lines.
file=$(readlink -f "$1")
dir=${file%/*}
base="${file%.*}"
@ -36,7 +35,8 @@ case "$ext" in
cs) mcs "$file" && mono "$base".exe ;;
go) go run "$file" ;;
h) sudo make install ;;
java) java -d classes "$file" && java -cp classes "${1%.*}" ;;
# findup is a script available here: https://unix.stackexchange.com/a/35265
java) loc=$(findup . -name gradlew); [ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)" ;;
m) octave "$file" ;;
md) if [ -x "$(command -v lowdown)" ]; then
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf

11
.local/bin/findup Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
path="$1"
shift 1
while [[ $path != / ]];
do
find "$path" -maxdepth 1 -mindepth 1 "$@"
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
path="$(readlink -f "$path"/..)"
done

View File

@ -6,11 +6,11 @@ bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files"
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
lf_tags="${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-tags"
tmp="/tmp/shortcut-tmp"
lf_files="${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-files"
lf_dirs="${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-dirs"
# Remove, prepare files
rm -f "$shell_shortcuts" "$lf_tags" "$zsh_named_dirs" 2>/dev/null
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$zsh_named_dirs" 2>/dev/null
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs.
@ -18,13 +18,11 @@ eval "echo \"$(cat "$bmdirs")\"" | \
awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42cd %s && tput cuu1;tput el\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"%s:\52\n\",\$2) > \"$tmp\" }"
printf(\"%s\n\",\$2) >> \"$lf_dirs\" }"
# Format the `files` file in the correct syntax and sent it to both configs.
eval "echo \"$(cat "$bmfiles")\"" | \
awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"%s:\52\n\",\$2) > \"$tmp\" }"
mv $tmp $lf_tags
printf(\"%s\n\",\$2) >> \"$lf_files\" }"