Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add demo to README #54

Merged
merged 5 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ information about the current git branch and is inspired by
[![go](https://img.shields.io/static/v1?style=flat-square&label=&message=v1.22.0&logo=go&labelColor=282828&logoColor=9dbad4&color=9dbad4)](https://go.dev/)
[![semantic-release: angular](https://img.shields.io/static/v1?style=flat-square&label=semantic-release&message=angular&logo=semantic-release&labelColor=282828&logoColor=d8869b&color=8f3f71)](https://github.com/semantic-release/semantic-release)

![git-prompt-string](https://github.com/mikesmithgh/git-prompt-string/assets/10135646/80dd6b32-8155-4a07-9801-358f413ddbe8)


> [!WARNING]\
> 03/25/2024: git-prompt-string (previously bgps) is actively undergoing a major rewrite
>
Expand Down
80 changes: 80 additions & 0 deletions scripts/git-prompt-string-demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env bash

# Utility script to execute demo steps via Kitty

# gif generated with
# ffmpeg -i git-prompt-string-demo.mov -r 5 frame%04d.png
# gifski --quality 97 --motion-quality 97 --lossy-quality 97 --width 1200 --height 627 -o git-prompt-string.gif frame*.png

win= # replace with kitty window ID
delay='0.2'

if [[ -z "$win" ]]; then
printf "Please povide kitty window ID"
exit 1
fi

function kitty_send_text() {
kitty @ send-text "--match=id:$win" "$@"
}

function feed_no_newline() {
str=""
for word in "$@"; do
str="$str $word"
done
str="${str:1}" # trim leading space
for ((i = 0; i < ${#str}; i++)); do
char="${str:i:1}"
kitty_send_text "$char"
sleep "$delay"
done
}

function feed() {
feed_no_newline "$@"
feed_str '\n'
}

function feed_str() {
str="$1"
kitty_send_text "$str"
sleep "$delay"
}

feed clear
sleep 3
feed git reset --hard 7e47962
feed vi README.md
feed '/Installation'
feed 'OTODO: add demo'
feed_str '\x1b'
feed ':wq'
feed 'touch new_file.txt'
feed 'rm -f new_file.txt'
feed git add .
feed 'git commit -m "chore: add TODO message"'
feed git merge
feed git mergetool
feed ':%diffg REMOTE'
feed ':wqa'
feed 'git merge --abort'
feed git rebase
feed git rebase --abort
feed 'git reset --hard @{u}'
feed cd .git
feed cd -
feed 'rm -rf tmp/bare_repo && mkdir -p tmp/bare_repo && cd tmp/bare_repo'
feed git init --bare
feed cd -
feed git bisect HEAD~3
feed Y
feed git bisect reset
feed git checkout -b demo_branch
feed git push -u
sleep 2.5
feed git push origin :demo_branch
sleep 2.5
feed git checkout -
feed git branch -d demo_branch
feed clear
Loading