vlad doster eed099b954 Cohesive shell script formatting
- Format all shell scripts using [shfmt]
  (https://github.com/mvdan/sh).

Options used:

* `-bn`: binary ops like && and | may start a line
* `-sr`: redirect operators will be followed by a space
* `-ci`: indent switch cases
* `-i 4`: indent 4 spaces
* `-s`: simplify the code
* `-p`: parse for posix compliance

- Add Github action to lint changes to scripts and enforce formatting
  going forward

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2021-03-15 06:16:20 -05:00

14 lines
483 B
Bash
Executable File

#!/bin/sh
# opout: "open output": A general handler for opening a file's intended output,
# usually the pdf of a compiled document. I find this useful especially
# running from vim.
basename="$(echo "${*}" | sed 's/\.[^\/.]*$//')"
case "${*}" in
*.tex | *.m[dse] | *.[rR]md | *.mom | *.[0-9]) setsid -f xdg-open "$basename".pdf > /dev/null 2>&1 ;;
*.html) setsid -f "$BROWSER" "$basename".html > /dev/null 2>&1 ;;
*.sent) setsid -f sent "$1" > /dev/null 2>&1 ;;
esac