demo-cli
0.0.2
See the version list below for details.
dotnet tool install --global demo-cli --version 0.0.2
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local demo-cli --version 0.0.2
#tool dotnet:?package=demo-cli&version=0.0.2
nuke :add-package demo-cli --version 0.0.2
demo
It's a tool to assist you in your presentation terminal demonstrations
Getting started
Install latest version using dotnet
client: (recomended)
dotnet tool install --global demo-cli
Or update to latest version:
dotnet tool update --global demo-cli
Create a file called hello.bash
with the content bellow:
@prompt [green]hello[/]\n$\s
@loading 2000
# set variable
$ text="hello world"
# show variable value
$ echo $text
@running 2000
hello world
@sleep 2000
bye
@clear
And run it:
demo play hello.bash
Note: in order to see commands (lines starting with
$
) you need to press any key and finnaly pressEnter
key to go to the next step.
To see the full list of options, run the following command:
demo play --help
Instructions
Title
The line starting with #
will be used as the title. A title is written in gray and aligned to the right on the terminal.
p.e.
# my title
Command
The line starting with $
is a command.
If you want to get a command output, you need to press any key until all the text is typed. And to go to the next step you need to press the Enter
key.
p.e.
$ tar tf file.tgz
Function
The line starting with @
will be evaluated to execute a function.
Function list:
@clear
: clears the terminal.@prompt {markup}
: changes the user prompt. The user prompt is written before a command.@sleep {millis}
: sleeps for the specified number of milliseconds.@loading {millis}
: shows a loading animation for the specified number of milliseconds.@running {millis}
: shows a running animation for the specified number of milliseconds.
p.e
@prompt [green]hello[/]\s#\s
@sleep 2000
@loading 2000
@running 2000
@clear
General output
Any other line will be use a general output.
p.e
hello world
| a | b | c |
-------------------
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Markup
To render a text interminal demo uses Spectre.Console. You can use this library markup language and emojis to render rich text.
p.e
# colors
[red]Foo[/]
[#ff0000]Bar[/]
[rgb(255,0,0)]Baz[/]
# back colors
[bold yellow on blue]Hello[/]
# emojis
Hello :globe_showing_europe_africa:!
# escaped
[[Hello]]
Output script
If you want to create a bash script to execute the demo, you can use the following command:
demo script hello.script
You can execute the script in the terminal:
demo script hello.script | bash
Or you can save it to a file:
demo script hello.script -a true > hello.sh
To see the full list of options, run the following command:
demo script --help
License
The source code we develop at demo is default being licensed as MIT. You can read more about here.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
0.0.4 | 497 | 5/5/2022 |
0.0.3 | 439 | 5/4/2022 |
0.0.2 | 437 | 4/26/2022 |
0.0.1 | 443 | 4/26/2022 |
0.0.1-beta | 292 | 4/26/2022 |
0.0.1-alpha | 257 | 4/26/2022 |