NAME
patra - Play back shell commands for live demonstrations
SYNOPSIS
patra [-m] COMMAND_FILE
DESCRIPTION
Important: patra
is an experimental fork from cleo
. You should check the current differences from App-Cleo
and decide, which one you want to use. It may be, that in your current time, patra
is merged back into cleo
or obsolete for other reasons.
patra
is a utility for playing back pre-recorded shell commands in a live demonstration. patra
displays the commands as if you had actually typed them and then executes them interactively.
There is probably an easy way to do this with expect
or a similar tool. But I couldn't figure it out, so I built this. Your mileage may vary.
PLAYBACK
patra
pauses and waits for a keypress before displaying a command and before executing it. Pressing any key besides those listed below will advance the playback:
Key Action
------------------------------------------------------------------
s skip the current command
r redo the current command
p redo the previous command
c run all remaining commands
q quit playback
[number][not a digit] jump to specific command number
COMMANDS
patra
reads commands from a file. Each line is treated as one command. Blank lines and those starting with #
will be ignored. The commands themselves can be anything that you would type into an interactive shell. You can also add a few special tokens that patra
recognizes:
!!!
-
Commands starting with
!!!
(three exclamation points) are not displayed and will be executed immediately. This is useful for running setup commands at the beginning of your demonstration. ...
-
Commands starting with
...
(three periods) will be executed without waiting for a keypress. This is useful if you want to show a series of commands but don't need to stop and explain each one as you go. %%%
-
Within a command,
%%%
(three percent signs) will cause playback to pause and wait for a keypress before displaying the rest of the command. This is useful if you want to stop in the middle of a command to give some explanation. $
-
This syntax is only supported, when you start
patra
with the option-m
. You then should preceed each commend with$
(Dollar
,Space
). Your advantage then is, that you can scatter your commands over mutliple lines, as far as Bash can handle it.
Otherwise, patra
displays and executes the commands verbatim. Note that some interactive commands like vim
are picky about STDOUT and STDIN. To make them work properly with patra
, you may need to force them to attach to the terminal like this:
(exec < /dev/tty vim)
EXAMPLE
Ryan uses this for giving demonstrations of pinto, such as the one seen at https://www.youtube.com/watch?v=H-JkFXm8Xgk (the live demonstration part starts around 10:47).
The command file that I use for that presentation is included inside this distribution at examples/pinto.demo. This file is for illustration only, so don't expect it to actually work for you.
LIMITATIONS
patra
only works on Unix-like platforms.
TODO
AUTHOR
Jeffrey Ryan Thalhammer <thaljef@cpan.org>
Boris Däppeb (BORISD) <bdaeppen.perl@gmail.com>
COPYRIGHT
cleo - Copyright (c) 2014, Imaginative Software Systems
patra - Boris Däppen (BORISD) 2018