2024-08-04 21:00:23 -04:00
|
|
|
--- README
|
2023-11-12 23:34:56 -05:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
A tool to run embedded scripts.
|
2023-09-27 01:28:54 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Bootstrap with ./shake bake.c
|
|
|
|
then compile further with ./bake,
|
|
|
|
install by running ./install.sh
|
2023-11-12 23:34:56 -05:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
---
|
2023-11-12 23:34:56 -05:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
bake [-chln] [-s <n>] <FILENAME> [ARGS...]; version 20240804
|
2023-09-27 01:28:54 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Bake is a simple tool meant to execute embedded shell commands within
|
|
|
|
any file. It executes with /bin/sh the command after a "@BAKE " to
|
|
|
|
the end of the line (a UNIX newline: '\n').
|
2023-09-27 01:28:54 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
It expands some macros,
|
|
|
|
@NAME - filename
|
|
|
|
@SHORT - shortened filename
|
|
|
|
@ARGS - other arguments to the program
|
|
|
|
@LINE - line number at the selected @BAKE
|
2023-10-15 20:56:16 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
All macros can be exempted by prefixing them with a backslash,
|
|
|
|
which'll be subtracted in the expansion. multi-line commands may be
|
|
|
|
done by a leading backslash, which are NOT subtracted.
|
2024-02-14 13:26:19 -05:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
It has five options, this message (-h, --help); prevents the execution
|
|
|
|
of the shell command (-n, --dry-run); disable color (-c, --color); list
|
|
|
|
(-l, --list) and select (-s<n>, --select <n>) which respectively lists
|
|
|
|
all @BAKE commands and select & run the Nth command.
|
2023-09-28 02:20:48 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
It roots the shell execution in the directory of the given file.
|
2023-10-15 20:56:16 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Licensed under the public domain.
|
2023-11-12 23:34:56 -05:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
---
|
2023-09-27 01:59:13 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Shake
|
2023-09-27 01:28:54 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Bake was inspired by the Bash-based Shake utility (formerly eMake, he
|
|
|
|
liked my suggestion for a name). It is included under authorization
|
|
|
|
of its creator. The original version of Shake may be found at:
|
|
|
|
<http://bis64wqhh3louusbd45iyj76kmn4rzw5ysawyan5bkxwyzihj67c5lid.onion/anon/shake>
|
2023-09-28 02:20:48 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Bake includes a modified Shake, both after installation and as a
|
|
|
|
bootstrapper. The modified version includes all features of Bake with
|
|
|
|
the exceptions of multi-line commands. It is not a general
|
|
|
|
replacement for Bake.
|
2023-09-28 02:20:48 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Changelog
|
2023-09-28 02:20:48 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Bake was created on 2023/09/13, and is complete as of 2024/03/02.
|
2023-09-28 02:20:48 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
24/08/04 - Updated version!
|
2023-09-27 01:28:54 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
Bake is has been finished for a while but I thought the code could use
|
|
|
|
a checkup with GNU complexity, and this gave me a reason to rewrite
|
|
|
|
the important parts into a more sane manner. I had, at the same time,
|
|
|
|
been requested to extend Bake with the @LINE and list/select.
|
2023-10-15 20:56:16 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
The changeset is large enough to possibly introduce bugs, and the last
|
|
|
|
version of Bake is, in my opinion, highly reliable. This newer version
|
|
|
|
needs to be tested a bit more to confirm full compatibility.
|
2023-09-27 02:05:22 -04:00
|
|
|
|
2024-08-04 21:00:23 -04:00
|
|
|
changes - Rewrite of the code; Removal of -x --expunge; Addition of
|
|
|
|
@LINE & @NAME, list, & select.
|
2024-08-31 19:05:09 -04:00
|
|
|
|
|
|
|
24/08/22 - Expunge
|
|
|
|
|
|
|
|
I decided to add expunge back in, after I went back to a project using
|
|
|
|
it, because I didn't feel like writing a regexp that would prune it.
|
|
|
|
|
|
|
|
It works the same. However it's less tested. Backslashes are reliable.
|
|
|
|
It doesn't eat characters around itself and returns a reliable string.
|
|
|
|
It does, however, cover the same space as the origin string.
|
|
|
|
|
|
|
|
Such brutal expressions as '@{\} @{\}@SHORT\}}' -> '} @{}@SHORT}'
|
|
|
|
successfully, with expunge_me correctly containing only that.
|
|
|
|
|
|
|
|
It's the same, as before. Sadly I didn't generalize the search and
|
|
|
|
replace code, that's what sed is for, and I didn't want to implement
|
|
|
|
finite automata for this simple update, so its implementation is primitive.
|
|
|
|
|
|
|
|
The implementation as a whole was meant for simplicity,
|
|
|
|
extensibility. I, before getting it working, got a gorilla version
|
|
|
|
that removed contextless @{ } successfully, and a version that
|
|
|
|
contextually removed each @{ and it's respective } via expand.
|
|
|
|
|
|
|
|
Interesting note: Old Bake's executable is larger than new Bakes.
|
|
|
|
So, not only do we have constant memory, but I've saved space.
|
|
|
|
|
|
|
|
Note that the only real limitation is that, that we can't make a @BAKE
|
|
|
|
command the size of THIS file, or a a @BAKE command inlining all of
|
|
|
|
Bake. If you need such a feature, use the old version of Bake, or
|
|
|
|
simply extend this version. I may do such things, because the code
|
|
|
|
here is better.
|
|
|
|
|
|
|
|
This project really was never meant to be optimized, simply memory
|
|
|
|
confined. if it goes over, it'll SEGV and imply to the diligent user
|
|
|
|
to shorten his commands. If you just need enough in a simple fashion,
|
|
|
|
boosting:
|
|
|
|
#define BUFFER_SIZE (1 << 12) /* 4096 bytes; 4 KiB */
|
|
|
|
TO (1 << 20) /* 1048576 bytes; 1 MiB */
|
|
|
|
|
|
|
|
4 KiB is enough in 99% cases and covers 100% of usage that I am aware
|
|
|
|
of apart from the case of testing this exact faculty. If it does limit
|
|
|
|
you, you can use an external script or <Using Make!/Old Bake>
|
|
|
|
|
|
|
|
I'm not planning to update Shake with @STOP, @LINE, (-x, --expunge),
|
|
|
|
or any new bells and wistles.
|