mirror of https://github.com/cheat/cheat.git
Add upload script and svg
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
parent
4f6256187c
commit
9b3ace6954
17
README.md
17
README.md
|
@ -4,6 +4,23 @@
|
|||
cheat
|
||||
=====
|
||||
|
||||
<!-- TODO: change link to point to your upload to asciinema. -->
|
||||
<div align="center">
|
||||
<a href="https://asciinema.org/a/Euf4KZlGhbHmmUfrROMel2yny">
|
||||
<img width="600" src="/doc/demo/cheat_demo.svg" />
|
||||
</a>
|
||||
<br />
|
||||
<sub>
|
||||
This demo was created using
|
||||
<a href="https://github.com/veracioux/tuterm">tuterm</a>.
|
||||
</sub>
|
||||
<br /><br />
|
||||
<sub>
|
||||
Run <code>tuterm doc/demo/cheat.tut</code> in this repository for an interactive tutorial.
|
||||
</sub>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
`cheat` allows you to create and view interactive cheatsheets on the
|
||||
command-line. It was designed to help remind \*nix system administrators of
|
||||
options for commands that they use frequently, but not frequently enough to
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# Automated demo/interactive tutorial
|
||||
|
||||
[Tuterm](https://github.com/veracioux/tuterm) is used to create a fully automated real-time demonstration of the program.
|
||||
The demonstration is generated from the script `cheat.tut`, and it can be
|
||||
played in the terminal by running `tuterm -m demo cheat.tut`.
|
||||
|
||||
To upload the demonstration, run `./asciinema_upload_and_create_svg.sh`. This
|
||||
script will upload to asciinema and give you back the URL, and create the SVG
|
||||
file `cheat_demo.svg`, both of which are meant to be included in the `README.md`.
|
||||
The SVG file should be included in version control. If you open the script, you
|
||||
will find some tweakable parameters.
|
||||
|
||||
The `cheat.tut` can also serve as an interactive tutorial, if you run `tuterm cheat.tut`.
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# NOTE: Change this to suit your needs
|
||||
|
||||
TERM_WIDTH=80
|
||||
TERM_HEIGHT=18
|
||||
RECORDED_COMMAND="tuterm cheat.tut --mode demo"
|
||||
alias copy='xsel -b'
|
||||
|
||||
# Dependencies:
|
||||
# - asciinema (https://github.com/asciinema/asciinema)
|
||||
# - svg-term (https://github.com/marionebl/svg-term-cli)
|
||||
# - xsel
|
||||
|
||||
# Tuterm can be found here:
|
||||
# https://github.com/veracioux/tuterm
|
||||
|
||||
rm -f /tmp/cheat.cast
|
||||
|
||||
stty cols "$TERM_WIDTH" rows "$TERM_HEIGHT"
|
||||
# Record the command
|
||||
asciinema rec -c "$RECORDED_COMMAND" /tmp/cheat.cast
|
||||
|
||||
# Change terminal width and height
|
||||
# NOTE: for some reason the yes command prints Broken pipe; this is a workaround
|
||||
sed -e "1 s/\(\"width\": \)[0-9]\+/\1$TERM_WIDTH/" \
|
||||
-e "1 s/\(\"height\": \)[0-9]\+/\1$TERM_HEIGHT/" \
|
||||
-e '/Broken pipe/d' \
|
||||
-i /tmp/cheat.cast
|
||||
|
||||
# Upload to asciinema.org
|
||||
output="$(asciinema upload /tmp/cheat.cast)"
|
||||
echo "$output"
|
||||
|
||||
# Copy URL to clipboard
|
||||
echo "$output" | grep 'https:' | sed 's/^\s*//' | copy
|
||||
|
||||
# Create local SVG animation
|
||||
cat /tmp/cheat.cast | svg-term --out cheat_demo.svg
|
||||
|
||||
echo "SVG animation saved as 'cheat_demo.svg'"
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 67 KiB |
Loading…
Reference in New Issue