]> git.xolatile.top Git - emil-bake.git/commitdiff
Document and break.
authorEmil Williams <emilemilemil@cock.li>
Sat, 4 Jan 2025 22:10:15 +0000 (15:10 -0700)
committerEmil Williams <emilemilemil@cock.li>
Sat, 4 Jan 2025 22:10:15 +0000 (15:10 -0700)
README
awake
bake.1
bake.l
install.sh
shake

diff --git a/README b/README
index d8a09166e1ee234a3b0c10406a9d3d26706f33a7..2d7ea5287fb6b5310c57d0b881540a0191619233 100755 (executable)
--- a/README
+++ b/README
@@ -1,10 +1,11 @@
 --- README
 
-A tool to run embedded scripts.
+Run embedded scripts.
 
-Bootstrap with ./shake bake.l
+Bootstrap with ./awake bake.l
 then compile further with ./bake,
-install by running ./install.sh
+
+or JUST install by running ./install.sh (has --help)
 
 ---
 
@@ -17,12 +18,11 @@ of @STOP. All @BAKE ... @STOP statements must become before any @BAKE
 ... EOLs.
 
 It expands some macros,
-  @FILENAME @FILE @NAME - filename
+  @FILE                 - filename
   @SHORT                - filename without suffix (abc.x.txt \-> abc.x)
   @SHORT:N              - removes N suffixes, so (a.b.c 2 -> a)
   @ARGS                 - other arguments to the program
-  @ARGS:N               - Provides the Nth argument, starting from
-0
+  @ARGS:N               - Provides the Nth argument, starting from 0
   @ARGS:N+              - All arguments at and after Nth
   @RECURS               - the full path name to the executable
   @LINE                 - line number at the selected @BAKE
@@ -31,10 +31,10 @@ All  macros  can be  exempted  by  prefixing  them with  a  backslash,
 which'll be subtracted in the  expansion. commands may be spanned over
 several lines with a leading backslash.
 
--h --help      | Help message
+-h --help       | Help message
 -n --dry-run   | don't execute or remove anything
--c --color     | disables color
--l --list      | lists available Bake blocks
+-c --color      | disables color
+-l --list       | lists available Bake blocks
 -s --select <n>        | selects Nth Bake block
 -x --expunge   | Removes the file specified in the expunge block
 
@@ -59,6 +59,16 @@ Changelog
 
 Bake was created on 2023/09/13, and complete as of 2024/03/02.
 
+2024-03-02
+
+Initial relaase
+
+2024-04-04
+
+Expunge & color.
+
+2024-04 - 2024-08 - 3 Tags of bump -> minor fixes and improvements
+
 2024-09-27
 
 Lex. As adviced by the original creator, I learned and implemented
@@ -75,3 +85,23 @@ to the BSDs.
 
 cd /dir/of/file; awake file
 See --help
+
+2025-01-04
+
+Introducing some breaking changes.
+Remove @FILENAME @NAME, and @FILE_NAME (heyo) leaving only @FILE.
+Upgraded ./install.sh to have options.
+
+s/@(FILE_?NAME|NAME)/@FILE/g
+
+I'm finished with tool for the rest of time and have put zero effort
+into it this time. If I use it and it breaks, I'll fix it or replace
+it with something better.
+
+Anonson, the original creator made a ebuild for Gentoo a few months
+ago, and I will link it here when I receive that link from him. I may
+one day dare to package Bake as a deb. I would likely have to rename
+bake to ebake, which is somehow worse than the original name of eMake.
+
+ebuild: <PENDING>
+debian: <PENDING> (perhaps forever)
diff --git a/awake b/awake
index d951b4e2a20645d7a2204966d2ac201f15fb9675..1d308d287ec6063404c7100571196cdf1ddc7695 100755 (executable)
--- a/awake
+++ b/awake
@@ -69,7 +69,7 @@ BEGIN {
        if (list) {
                print bakenum": "$0
        } else if (select == bakenum) {
-               gsub(/\$@|@(FILE_NAME|FILENAME|FILE|NAME)/, filename)
+               gsub(/\$@|@FILE/, filename)
                gsub(/\$\*|@SHORT/, shortname)
                gsub(/\$\+|@ARGS/, extraargs)
                gsub(/@RECURS/, ARGV[0])
diff --git a/bake.1 b/bake.1
index 241df3026ff642013d5c25ef709321043cf6d61c..b4a5eab2becfe4ebe1b6a15519eb659d1683b90d 100755 (executable)
--- a/bake.1
+++ b/bake.1
@@ -35,7 +35,7 @@ extend a command over several lines.
 
 These macros will expand to their counterpart before execution.
 .TP
-.B @FILENAME, @FILE, @NAME, $@
+.B @NAME, $@
 returns target\-file (abc.x.txt)
 .TP
 .B @SHORT, $*
diff --git a/bake.l b/bake.l
index 50c3b3176d757904e77d7a982011348a6ad7fabb..4b8248a3084b9343408e8b0482ecbefda1a80197 100755 (executable)
--- a/bake.l
+++ b/bake.l
@@ -28,8 +28,8 @@ extern void shorten(char * filename, int n);
 
 SPACE [ \t\r\v\f]
                         /* Everything that can be backslashed */
-FILENAME (@FILE_NAME|@FILENAME|@FILE|@NAME)
-CMD       @BAKE[[:space:]]
+FILENAME @FILE
+CMD      @BAKE[[:space:]]
 MACROS   ({CMD}|@STOP|{FILENAME}|@SHORT|@ARGS|@LINE|@RECURS|$@|$*|$+|@\{)
 
 %x FOUND PADDING STOP
index e2668c33f4547c6eeeb886e78eabc70af44cade1..e8065121441190d26ec4afc1371b4eb98ec74f44 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 # source install
 
+cd "$(dirname "$(readlink -f $0)")" || exit
+
 TARGET="${TARGET:-/usr/local}"
 INSTALL="bake"
 
@@ -9,6 +11,7 @@ usage() {
     echo ""
     echo "--alternatives          Includes awake and shake into the build"
     echo "--target=DIRECTORY      Target directory like /usr or /usr/local"
+    echo "--prebuilt              Program is prebuilt"
     echo ""
     exit 1
 }
@@ -24,6 +27,9 @@ while [ ! -z $1 ]; do
         "--help")
             usage
             ;;
+        "--prebuilt")
+            BUILD=1
+            ;;
         *)
             echo "Unknown option: " $1
             usage
@@ -32,9 +38,10 @@ while [ ! -z $1 ]; do
     shift
 done
 
-cd "$(dirname "$(readlink -f $0)")"
+if [ -z $BUILD ]; then
+    ./awake bake.l
+fi
 
-./awake bake.l
 mkdir -p "$TARGET/bin" "$TARGET/man/man1"
 install -m 755 $INSTALL "$TARGET/bin"
 gzip -c bake.1 > "$TARGET/man/man1/bake.1.gz"
diff --git a/shake b/shake
index e2cf12064eefffa1a296a23d6900e51600d41120..21637c4610273048ea78d6a588d206357398b5bd 100755 (executable)
--- a/shake
+++ b/shake
@@ -76,12 +76,9 @@ if [[ -n $line ]]; then
     line=${line//\$@/$input_file}
     line=${line//\$\*/${input_file%.*}}
     line=${line//\$+/$@}
-    line=${line//@FILE_NAME/$input_file}
     line=${line//@FILENAME/$input_file}
     line=${line//@SHORT/${input_file%.*}}
     line=${line//@ARGS/$@}
-    line=${line//@NAME/$input_file}
-    line=${line//@FILE/$input_file}
     line=$(echo "$line" | sed 's/@STOP.*//')
 
     echo -e "${BOLD}${GREEN}$0${NORMAL}: ${line#*${MARK}}"