bake/bake.1

76 lines
2.1 KiB
Groff
Raw Normal View History

.TH BAKE "1" "August 2024" "bake 20240927" "User Commands"
2024-02-26 23:19:55 -05:00
.SH NAME
.B bake
\- file embeddable scripts
.SH SYNOPSIS
.B bake
2024-08-31 19:05:09 -04:00
[\-chlnx] [\-s <N>] <FILENAME> [ARGS...]
2024-02-26 23:19:55 -05:00
.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').
2024-02-26 23:19:55 -05:00
2024-09-28 19:06:05 -04:00
This format may be embedded within \fBany file\fP.
2024-02-26 23:19:55 -05:00
It roots the shell execution in the directory of the given file.
2024-02-26 23:19:55 -05:00
2024-09-28 19:06:05 -04:00
Options must always be put before the filename, and short options may be merged together, numerical options must be trailing.
2024-02-26 23:19:55 -05:00
.HP
2024-08-31 19:05:09 -04:00
\-h \-\-help, Help message
2024-09-28 19:06:05 -04:00
\fB\-n \-\-dry\-run\fP, don't execute anything
\fB\-c \-\-color\fP, disables color
\fB\-l \-\-list\fP, lists available shell commands
\fB\-s \-\-select\fP \<n\>, selects Nth shell command
\fB\-x \-\-expunge\fP, Removes what's specified in the expunge block
2024-02-26 23:19:55 -05:00
.PP
Macros
All macros can be exempted by prefixing them with a backslash,
2024-09-28 19:06:05 -04:00
which'll be subtracted in the expansion. backslashes may be used to
extend a command over several lines.
2024-02-26 23:19:55 -05:00
These macros will expand to their counterpart before execution.
2024-02-26 23:19:55 -05:00
.TP
.B @FILENAME, @FILE, @NAME, $@
returns target\-file (abc.x.txt)
2024-02-26 23:19:55 -05:00
.TP
.B @SHORT, $*
2024-02-26 23:19:55 -05:00
returns target\-file without suffix (abc.x.txt \-> abc.x)
supports choice syntax, @SHORT:N removes N suffixes, so (a.b.c 2 -> a)
2024-02-26 23:19:55 -05:00
.TP
.B @ARGS, $+
2024-09-28 19:06:05 -04:00
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
2024-09-28 19:06:05 -04:00
.TP
.B @RECURS
returns full executable name (e.g. /usr/local/bin/bake)
2024-04-06 19:59:15 -04:00
.PP
Additional Features And Notes
Shell execution may be disabled with the \fB-n\fP or \fB--dry-run\fP option.
2024-09-28 19:06:05 -04:00
Expunge removes exactly one file specified in the @{TEXT} format, and
is not recursive. Expunge simply outputs rm 'TEXT...', where text
expands any instance of ' to \\'.
2024-04-06 19:59:15 -04:00
2024-02-26 23:19:55 -05:00
.SH EXAMPLE
.\" SRC BEGIN (example.c)
.EX
// example.c @BAKE cc -o @SHORT @NAME @ARGS
2024-02-26 23:19:55 -05:00
#include <stdio.h>
int main (void) {
puts("Hello.");
return 0;
2024-02-26 23:19:55 -05:00
}
.EE
.SH COPYRIGHT
.PP
Licensed under the public domain.