porchgen
— porch
script generator
porchgen |
-f scriptfile
command [argument ..] |
The porchgen
utility generates an
orch(5)
sxript based on user interaction with the spawned command.
The following options are available for
porchgen
:
-f
scriptfile
- Names the scriptfile to create.
-h
- Show a usage statement.
porchgen
operates by first
spawning the requested command, then polling for both
output from the command and input from the user. A
spawn
()
statement is written to the scriptfile to match the
command passed in. Output from the command is sent
immediately to the user as it comes in, and internally recorded. When a line
comes in from the user, porchgen
records a
match
()
block from the last line of output recorded, and adds up to two previous
lines of output in commented out match
() blocks for
context that might have been necessary. A
write
()
statement is then issued for the line received before it is passed along to
the command.
Execution continues and blocks are emitted until either stdout of
the command or stdin of porchgen
reach EOF.
The porchgen
utility exits 0 on success,
and >0 if an error occurs. EOF on the command
stdout is considered an error if the process was signalled or exited with a
non-zero exit code. EOF on stdin is currently always considered an
error.