| Crates.io | swordfish-rs |
| lib.rs | swordfish-rs |
| version | 0.6.0 |
| created_at | 2022-09-09 10:07:44.666797+00 |
| updated_at | 2022-09-17 17:28:24.543777+00 |
| description | Cli tool for typing effect in Termainl for screencasts |
| homepage | |
| repository | https://github.com/vim-zz/swordfish/ |
| max_upload_size | |
| id | 661764 |
| size | 25,180 |
Typing effect cli tool for screencasts and demos
screenplay file till perfection
Example screenplay.yaml file:
- !clear
# - !turbo {by: 3}
- !write {msec: 0, color: green, text: "$ "}
- !write {msec: 20, text: "i am going to list this dir"}
- !wait {msec: 1000}
- !erase {msec: 20, by_chars: xxxxxxxxxxxxxxxxxxxxxxxxxxx }
- !wait {msec: 1000}
- !write {msec: 20, text: ls}
- !wait {msec: 1000}
- !execute {line: ls -la}
- !wait {msec: 3000}
- !write {msec: 1000, color: green, text: "$ "}
- !write {msec: 20, text: "bye, press any key..."}
- !pause
Running swordfish screenplay.yaml:

Install:
cargo install swordfish-rs
Requires Rust on your machine, get it from https://rustup.rs
Create a screenplay file and run swordfish:
swordfish path/to/file.yaml
The following commands are available, written with ! before the command name, for example !clear.
clearClear screen command.
eraseErase characters to the left.
| Argument | Type | Description |
|---|---|---|
amount (optional) |
String | the amount of backspaces |
by_chars (optional) |
String | the amount of backspace is determined by the length of the provided text |
msec |
Integer | delay between individual backspaces in millisecs |
Use either amount or by_chars or both.
executeExecute shell commands or other applications and show their output.
| Argument | Type | Description |
|---|---|---|
line |
String | command line to execute, respects quoted arguments |
The output is presented, while the executed command itself will not show.
new_lineSimulate user's ENTER.
pausePause before next command and wait for user input (any key...)
promptPrompt specify a constant text that is shown after every execute and cis not affected by erase.
| Argument | Type | Description |
|---|---|---|
text |
String | the prompt text |
color (optional) |
String | text's color: black, red, green, yellow, blue, magenta, cyan, white or a brighter variant, for example bright_red |
turboSpeed everything, useful when iterating over the screenplay.
| Argument | Type | Description |
|---|---|---|
by |
Integer | Speed everything by this factor |
waitPauses execution for the specified time, then contrinues.
| Argument | Type | Description |
|---|---|---|
msec |
Integer | delay before next command in millisecs |
writeWrite text to the terminal.
| Argument | Type | Description |
|---|---|---|
text |
String | the text to type in the terminal, each character will be entered one by one with some delay |
msec |
Integer | delay between typed chars in millisecs |
color (optional) |
String | text's color: black, red, green, yellow, blue, magenta, cyan, white or a brighter variant, for example bright_red |