__________ / o \ | ____| | |___ | ____/ _| | _| |===E /\ _| ===E \ \___| | \___ / _____ ____ _/ |_ _| _ \ ___ ___ ___ | | | |_) / _ \/ __/ __| | | | _ < __/ (__\__ \ |_| |_| \_\___|\___|___/
Record screencasts in plain text.
To install TRecs, just run
gem install trecs
You have a TRecs file and want to reproduce it? You can do it on a terminal using the trecs
command.
Like this:
trecs <file>
You can also specify the refresh interval for the screen (terminal), using the --step
argument.
The value has to be an integer representing the amount of milliseconds between each screen refresh.
trecs <file> --step=800
trecs <file> -s 800
Wanna record a TRecs? Do it using the trecs_record
command.
There are several recording plugins available for use
Each options has a set of available flags (NOTE: the --help
argument don’t explain each one in detail yet)
The main option to select the recording alternative is the Recording Strategy, passed to TRecs via the --strategy
(-s
) argument.
Here it’s also available the --step
option, which will define the time between frames in milliseconds.
The most obvious use for this gem is recording a terminal session. This feature will be the default in the future, but it’s not fully implemented yet.
To record a terminal session, use the --strategy=ttyrec
option:
trecs_record playing_with_bash.trecs --strategy=ttyrec
This will open a new terminal session to record. You can finish the recording typing exit
or pressing C-d
, then the session will be saved to playing_with_bash.trecs
and will be ready for replaying.
You can record the changes that occur on a file by using --strategy=raw-file
.
What this does is sample a file every step
milliseconds and create a frame with that file’s contents.
To use it:
trecs_record my_changes.trecs --strategy=raw_file
Another possibility is to record a text message that will appear on screen character by character with an interval of step
milliseconds. This is currently the default functionality of the command trecs_record
trecs_record my_banner.trecs --strategy=incremental --step=50 --message="TRecs"
This will create 6 frames:
- 0 millis
- ””
- 50 millis
- “T”
- 100 millis
- “TR”
- 150 millis
- “TRe”
- 200 millis
- “TRec”
- 250 millis
- “TRecs”
Insert a message and se it fly from the right side of the screen
trecs_record my_banner.trecs --strategy=fly_from_right --step=50 --message="TRecs"
On some recording strategies, there’s also the posibility to run a custom shell command for each frame.
For example, you can use the wc
shell command to count the characters (or lines or words) of a banner that, for example appears one char at the time
trecs_record my_banner.trecs --strategy=incremental --step=50 --message="TRecs" --command="echo <frame> | wc -c"
This will run, for each frame the command <frame> | wc -c
Where <frame>
will be eplaced by the frame contents inside double quotes
And these are the generated frames with its corresponding commands:
- 0 millis
-
- frame
-
0
- command
-
echo "" | wc -c
- 50 millis
-
- frame
-
1
- command
-
echo "T" | wc -c
- 100 millis
-
- frame
-
2
- command
-
echo "TR" | wc -c
- 150 millis
-
- frame
-
3
- command
-
echo "TRe" | wc -c
- 200 millis
-
- frame
-
4
- command
-
echo "TRec" | wc -c
- 250 millis
-
- frame
-
5
- command
-
echo "TRecs" | wc -c
Currently applies to:
- Incremental Strategy
- Fly from right Strategy
Right now, you can extend TRecs in three possible ways
- Recording Strategies
- This is the object that defines what to record and how to process the input to be converted into frames. To give an example, the IncrementalStrategy (provided by TRecs), will take an input string, make an array with each of it’s characters and, for each char, append it to an output string and save the frame.
- Formats
- The format corresponds to the way the frames are stored. For example, using YamlStore, a tar file or a database.
- Tickers
- The Ticker is the way the user tells TRecs to advance frames.