Because sometimes you need to do it live
Current version: v2.1.0.
doitlive is a tool for live presentations in the terminal. It reads a file of shell commands and replays the commands in a fake terminal session as you type random characters.
$ doitlive play session.sh
# Use the "sorin" prompt theme
$ doitlive play session.sh -p sorin
# Increase speed
$ doitlive play session.sh -s 3
# Use zsh
$ doitlive play session.sh --shell /bin/zsh
You can record session files using the built-in recorder command.
$ doitlive record
This will start a recording session. When you are finished recording, run the stop command. All commands will be written to a session.sh file.
doitlive comes with many prompt themes. To use a theme:
$ doitlive play session.sh -p <theme_name>
You can also change a session’s theme by using a comment directive (see Comment magic below).
To view a list of available themes, run doitlive themes or doitlive themes --preview.
Any line in a session file that begins with # is a comment. Comments are ignored unless they begin with #doitlive, in which case they are used to configure the session.
The following options can be included at the top of your session file (all are optional).
configures the prompt. Can be any of the built-in themes or a custom prompt template.
Using a custom template:
You can provide the prompt option with a custom template. To include the user, hostname, current directory, current path to working directory, current datetime, or git branch, use {user}, {hostname}, {dir}, {cwd}, {now}, and {git_branch}, respectively.
Example: #doitlive prompt: {user} is at {cwd} $
Any of the prompt variables can be formatted with ANSI styles, like so:
Example: #doitlive prompt: {user.cyan}@{hostname.green}:{dir.bold.magenta} $
Available styles: blue, magenta, red, white, green, black, yellow, cyan, bold, blink, underlined, dim, paren, square, curly.
adds an alias to the session.
Example: #doitlive alias: du="du -ach | sort -h"
removes an alias.
unsets an environment variable.
doitlive supports autotyping in a Python console. You can enter Python mode in a session by enclosing Python code in triple-backticks within your session.sh file, like so:
# in session.sh
echo "And now for something completely different"
```python
list = [2, 4, 6, 8]
sum = 0
for num in list:
sum = sum + num
print("The sum is: {sum}".format(sum=sum))
```
To enable bash completion, add the following to your .bashrc or .bash_profile.
eval "$(_DOITLIVE_COMPLETE=source doitlive)"
Completion is currently only supported for bash.