about summary refs log tree commit diff stats
path: root/subtext.sh
diff options
context:
space:
mode:
authorCase Duckworth2024-02-06 00:12:15 -0600
committerCase Duckworth2024-02-06 00:12:15 -0600
commitf6ceb7e3972e08c1f554aa683ac19fa6e6d621c9 (patch)
tree5ca7079ecb5312cc80fe7dd24bf7913f262750da /subtext.sh
parentChange readme.md to readme.st that build to readme.html (diff)
downloadsubtext-f6ceb7e3972e08c1f554aa683ac19fa6e6d621c9.tar.gz
subtext-f6ceb7e3972e08c1f554aa683ac19fa6e6d621c9.zip
Various changes
Diffstat (limited to 'subtext.sh')
-rwxr-xr-xsubtext.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/subtext.sh b/subtext.sh index d845955..a60f0d6 100755 --- a/subtext.sh +++ b/subtext.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3stawk() { 3stawk() {
4 awk -f subtext.awk "$@" # SUBTEXT AWK SCRIPT HERE 4 awk -f subtext.awk "$@"
5} 5}
6 6
7usage() { 7usage() {
@@ -23,14 +23,17 @@ configure() {
23 : "${ST_MACROFILE:=}" 23 : "${ST_MACROFILE:=}"
24 : "${ST_SOPATH:=.:$HOME/.subtext}" 24 : "${ST_SOPATH:=.:$HOME/.subtext}"
25 : "${ST_PIPE_SH:=true}" 25 : "${ST_PIPE_SH:=true}"
26 : "${ST_TRACE=+x}"
26 ## Process options 27 ## Process options
27 while getopts :hm:I:n OPT 28 while getopts :hm:I:no:x OPT
28 do 29 do
29 case "$OPT" in 30 case "$OPT" in
30 (h) usage ;; 31 (h) usage ;;
31 (m) ST_MACROFILE="$OPTARG" ;; 32 (m) ST_MACROFILE="$OPTARG.st.sh" ;;
32 (I) ST_SOPATH="$ST_SOPATH:$OPTARG" ;; 33 (I) ST_SOPATH="$ST_SOPATH:$OPTARG" ;;
33 (n) ST_PIPE_SH=false ;; 34 (n) ST_PIPE_SH=false ;;
35 (o) exec > "$OPTARG" ;;
36 (x) ST_TRACE=-x ;;
34 (:) printf >&2 'Unknown option -%s\n' "$OPTARG"; 37 (:) printf >&2 'Unknown option -%s\n' "$OPTARG";
35 usage 1 ;; 38 usage 1 ;;
36 (*) usage 1 ;; 39 (*) usage 1 ;;
@@ -41,9 +44,9 @@ configure() {
41main() { 44main() {
42 configure "$@" 45 configure "$@"
43 shift $((OPTIND-1)) 46 shift $((OPTIND-1))
44 stawk -vsopath="$ST_SOPATH" "$@" | 47 stawk -vsopath="$ST_SOPATH" -vsofile="$ST_MACROFILE" "$@" |
45 if "$ST_PIPE_SH" 48 if "$ST_PIPE_SH"
46 then sh 49 then sh "$ST_TRACE"
47 else cat 50 else cat
48 fi 51 fi
49} 52}