mirror of
https://git.lain.church/bake/bake.git
synced 2025-04-21 17:39:40 +00:00
89 lines
2.6 KiB
Groff
Executable File
89 lines
2.6 KiB
Groff
Executable File
.TH BAKE "1" "January 2025" "bake 20250104" "User Commands"
|
|
.SH NAME
|
|
.B bake
|
|
\- file embeddable scripts
|
|
.SH SYNOPSIS
|
|
.B bake
|
|
[\-chlnx] [\-s <N>] <FILENAME> [ARGS...]
|
|
.SH DESCRIPTION
|
|
|
|
bake is a simple tool meant to execute embedded shell commands within
|
|
any file. It executes with /bin/sh the command after a "\fB@BAKE\fP
|
|
" to the end of the line (a UNIX newline: '\fB\\n\fP') or to the first
|
|
instance of @STOP. All @BAKE ... @STOP statements must become before
|
|
any @BAKE ... EOLs.
|
|
|
|
This format may be embedded within \fBany file\fP.
|
|
|
|
It roots the shell execution in the directory of the given file.
|
|
|
|
Options must always be put before the filename, and short options may be merged together, numerical options must be trailing.
|
|
|
|
.HP
|
|
\-h \-\-help, Help message
|
|
\fB\-n \-\-dry\-run\fP, don't execute or remove anything
|
|
\fB\-c \-\-color\fP, disables color
|
|
\fB\-l \-\-list\fP, lists available bake blocks
|
|
\fB\-s \-\-select\fP \<n\>, selects Nth bake block
|
|
\fB\-x \-\-expunge\fP, Removes file specified in the expunge block
|
|
.PP
|
|
Macros
|
|
|
|
All macros can be exempted by prefixing them with a backslash,
|
|
which'll be subtracted in the expansion. backslashes may be used to
|
|
extend a command over several lines.
|
|
|
|
These macros will expand to their counterpart before execution.
|
|
.TP
|
|
.B @NAME, $@
|
|
returns target\-file (abc.x.txt)
|
|
.TP
|
|
.B @SHORT, $*
|
|
returns target\-file without suffix (abc.x.txt \-> abc.x)
|
|
supports choice syntax, @SHORT:N removes N suffixes, so (a.b.c 2 -> a)
|
|
.TP
|
|
.B @ARGS, $+
|
|
returns \fBarguments\fP, supports choice syntax: @ARGS:N prints the
|
|
Nth argument starting from 0, leading plus prints inclusive remaining
|
|
arguments (@ARGS:N+)
|
|
.TP
|
|
.B @LINE
|
|
returns the line number
|
|
.TP
|
|
.B @RECURS
|
|
returns full executable name (e.g. /usr/local/bin/bake)
|
|
|
|
.PP
|
|
Additional Features And Notes
|
|
|
|
Shell execution may be disabled with the \fB-n\fP or \fB--dry-run\fP option.
|
|
|
|
Expunge removes exactly one file specified in the @{FILENAME} format,
|
|
and the action is nonrecursive. Expunge simply outputs rm 'FILENAME...',
|
|
where the FILENAME expands any instance of ' to \\'.
|
|
|
|
.PP
|
|
Other Implementations (NONDEFAULT)
|
|
|
|
Shake - Bash based, The modified version includes all features with
|
|
the exceptions of multi-line (as in to @STOP), select, and usable expunge.
|
|
|
|
Awake - AWK based, does not support multi-line (as in to @STOP), expunge,
|
|
parses options after filename, color, or changing directory to file's
|
|
directory - it's compatible with Bake otherwise.
|
|
|
|
.SH EXAMPLE
|
|
|
|
.\" SRC BEGIN (example.c)
|
|
.EX
|
|
// example.c @BAKE cc -o @SHORT @NAME @ARGS
|
|
#include <stdio.h>
|
|
int main (void) {
|
|
puts("Hello.");
|
|
return 0;
|
|
}
|
|
.EE
|
|
.SH COPYRIGHT
|
|
.PP
|
|
Licensed under the public domain.
|