-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from zakhenry/docs/asciinema
docs(Readme): Add asciinema demo to readme
- Loading branch information
Showing
7 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
if [[ ! -z $ASCIINEMA_REC ]]; then | ||
|
||
# profile built from ezprompt.net | ||
|
||
function nonzero_return() { | ||
RETVAL=$? | ||
[ $RETVAL -ne 0 ] && echo "$RETVAL" | ||
} | ||
|
||
# get current branch in git repo | ||
function parse_git_branch() { | ||
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` | ||
if [ ! "${BRANCH}" == "" ] | ||
then | ||
STAT=`parse_git_dirty` | ||
echo "[${BRANCH}${STAT}]" | ||
else | ||
echo "" | ||
fi | ||
} | ||
|
||
# get current status of git repo | ||
function parse_git_dirty { | ||
status=`git status 2>&1 | tee` | ||
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"` | ||
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"` | ||
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"` | ||
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"` | ||
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"` | ||
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"` | ||
bits='' | ||
if [ "${renamed}" == "0" ]; then | ||
bits=">${bits}" | ||
fi | ||
if [ "${ahead}" == "0" ]; then | ||
bits="*${bits}" | ||
fi | ||
if [ "${newfile}" == "0" ]; then | ||
bits="+${bits}" | ||
fi | ||
if [ "${untracked}" == "0" ]; then | ||
bits="?${bits}" | ||
fi | ||
if [ "${deleted}" == "0" ]; then | ||
bits="x${bits}" | ||
fi | ||
if [ "${dirty}" == "0" ]; then | ||
bits="!${bits}" | ||
fi | ||
if [ ! "${bits}" == "" ]; then | ||
echo " ${bits}" | ||
else | ||
echo "" | ||
fi | ||
} | ||
|
||
export PS1="\[\e[34m\]\w\[\e[m\] \[\e[32m\]\`parse_git_branch\`\[\e[m\] \[\e[31m\]\`nonzero_return\`\[\e[m\] \[\e[37m\]\\$\[\e[m\] " | ||
|
||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Asciinema instructions | ||
|
||
## setup | ||
|
||
1. install https://asciinema.org/docs/installation | ||
1. install https://github.com/marionebl/svg-term-cli | ||
1. `cd readme/asciinema` | ||
1. run `cat .bashrc >> ~/.bashrc` (if you haven't already) to set the prompt | ||
1. create a new repo with a simple readme and example source code file | ||
|
||
## record | ||
|
||
1. run `ASCIINEMA_REC=1 asciinema rec demo.cast --command bash` and record the session | ||
1. run `svg-term --in demo.cast --out demo.svg --window` | ||
1. run `cp demo.* ../embedme/readme/asciinema` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{"version": 2, "width": 121, "height": 60, "timestamp": 1561842446, "env": {"SHELL": "/bin/zsh", "TERM": "xterm-256color"}} | ||
[0.033895, "o", "\u001b[?1034h\u001b[34m~/repos/demo-project\u001b[m \u001b[32m\u001b[m \u001b[31m\u001b[m \u001b[37m$\u001b[m "] | ||
[1.53075, "o", "c"] | ||
[2.194579, "o", "a"] | ||
[2.362113, "o", "t"] | ||
[2.738741, "o", " "] | ||
[3.230015, "o", "R"] | ||
[3.402303, "o", "E"] | ||
[3.62664, "o", "ADME.md "] | ||
[4.161058, "o", "\r\n"] | ||
[4.16378, "o", "# My Awesome Project\r\n\r\n```ts\r\n// example.ts\r\n```\r\n"] | ||
[4.176117, "o", "\u001b[34m~/repos/demo-project\u001b[m \u001b[32m\u001b[m \u001b[31m\u001b[m \u001b[37m$\u001b[m "] | ||
[5.894175, "o", "n"] | ||
[6.076284, "o", "p"] | ||
[6.208257, "o", "x"] | ||
[6.384286, "o", " "] | ||
[6.59626, "o", "e"] | ||
[6.976219, "o", "m"] | ||
[7.236352, "o", "b"] | ||
[7.340119, "o", "e"] | ||
[7.512215, "o", "d"] | ||
[7.628282, "o", "m"] | ||
[7.756312, "o", "e"] | ||
[7.956989, "o", " "] | ||
[8.197245, "o", "R"] | ||
[8.588281, "o", "EADME.md "] | ||
[9.628081, "o", "\r\n"] | ||
[9.733475, "o", "\u001b[34mEmbedding...\u001b[39m\r\n"] | ||
[9.735356, "o", "\u001b[35m Analysing \u001b[4mREADME.md\u001b[24m...\u001b[39m\r\n"] | ||
[9.737251, "o", "\u001b[90m README.md#L3-L10\u001b[39m \u001b[32mEmbedded \u001b[92m4 lines\u001b[32m from file \u001b[4mexample.ts\u001b[24m\u001b[39m\r\n"] | ||
[9.737489, "o", "\u001b[35m Writing \u001b[4mREADME.md\u001b[24m with embedded changes.\u001b[39m\r\n"] | ||
[9.752726, "o", "\u001b[34m~/repos/demo-project\u001b[m \u001b[32m\u001b[m \u001b[31m\u001b[m \u001b[37m$\u001b[m "] | ||
[11.84902, "o", "c"] | ||
[12.012395, "o", "a"] | ||
[12.180163, "o", "t"] | ||
[12.326391, "o", " "] | ||
[12.886483, "o", "R"] | ||
[13.062608, "o", "E"] | ||
[13.302162, "o", "ADME.md "] | ||
[14.434319, "o", "\r\n"] | ||
[14.436839, "o", "# My Awesome Project\r\n\r\n```ts\r\n// example.ts\r\n\r\nexport function helloWorld(name: string): string {\r\n return `Hello ${name}!, how are you today?`;\r\n}\r\n\r\n```\r\n"] | ||
[14.451094, "o", "\u001b[34m~/repos/demo-project\u001b[m \u001b[32m\u001b[m \u001b[31m\u001b[m \u001b[37m$\u001b[m "] | ||
[18.309716, "o", "exit\r\n"] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.