-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add some scripts for generating usage example GIFs * Update top-level README.md, adding usage example GIFs Fixes #50.
- Loading branch information
1 parent
293c8e7
commit 9c5dd7a
Showing
14 changed files
with
182 additions
and
26 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
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
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 @@ | ||
scratch/ |
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,26 @@ | ||
# Usage Examples | ||
|
||
## Overview | ||
This directory contains scripts to produce GIFs of Nosey Parker usage examples. | ||
|
||
These scripts are written using [`vhs`](https://github.com/charmbracelet/vhs), a console script runner and recording tool. | ||
The example script fragments are in the [`examples`](examples) directory. | ||
Each one is a `vhs` fragment, which is cobbled together with some common settings using the [`record-examples.zsh`](record-examples.zsh) script. | ||
|
||
The generated GIFs are stored in the [`gifs`](gifs) directory. | ||
|
||
## Generating GIFs | ||
- Install `vhs` | ||
- Install `noseyparker` | ||
- `./record-examples.zsh` | ||
|
||
## Errata: `vhs` | ||
This tool, though it seems to be very popular, is full of significant bugs. | ||
What I've seen in a day's usage: | ||
|
||
- The `Show` and `Hide` commands seem to have a race condition, not reliably working without adding `Sleep 1s` calls before and after. | ||
Otherwise, you are likely to get the hidden commands included in the rendered output. | ||
|
||
- The `Source` command is unsuitable for its main use case (putting common settings in a separate file); the settings seem to be applied, then partially forgotten. | ||
|
||
- The framerate for GIF output is unreliable and doesn't correspond with `Sleep` durations, especially at higher framerates |
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,23 @@ | ||
Require echo | ||
Require less | ||
Require noseyparker | ||
|
||
# Set WindowBar Colorful | ||
# Set WindowBarSize 0 | ||
|
||
Set Margin 0 | ||
|
||
Set Padding 10 | ||
Set FontSize 20 | ||
Set LineHeight 1.1 | ||
Set Width 1200 | ||
Set Height 750 | ||
|
||
Set Shell "bash" | ||
Set TypingSpeed 25ms | ||
|
||
# Use a lower framerate to get more predictable GIF animation speed. | ||
# See https://github.com/charmbracelet/vhs/issues/88. | ||
Set Framerate 20 | ||
|
||
Output "output.gif" |
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,16 @@ | ||
Hide Type "clear" Enter Show Sleep 1s | ||
Type "# Run without arguments or with `-h` for help" Sleep 500ms Enter | ||
Type "noseyparker" Sleep 1s Enter | ||
Sleep 5s | ||
|
||
|
||
Hide Type "clear" Enter Show Sleep 1s | ||
Type "# Get more detailed help with `--help`" Sleep 500ms Enter | ||
Type "noseyparker --help | less" Sleep 1s Enter | ||
Sleep 5s Type "q" | ||
|
||
|
||
Hide Type "clear" Enter Show Sleep 1s | ||
Type "# Get detailed subcommand help with `CMD --help`" Sleep 500ms Enter | ||
Type "noseyparker scan --help | less" Sleep 1s Enter | ||
Sleep 5s Type "q" |
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,13 @@ | ||
Hide | ||
Sleep 1s | ||
Type "git clone -q 'https://github.com/Plazmaz/leaky-repo' && clear" Enter | ||
Sleep 1s | ||
Show | ||
|
||
Sleep 1s | ||
|
||
Type "# Scan the complete history of a local Git repository with the `scan` command." Sleep 0.5s Enter | ||
Type "# This example assumes you have a local clone of https://github.com/Plazmaz/leaky-repo." Sleep 1s Enter | ||
|
||
Type "noseyparker scan leaky-repo" Sleep 0.5s Enter | ||
Sleep 5s |
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,13 @@ | ||
Hide | ||
Sleep 1s | ||
Type "noseyparker -q scan --git-url 'https://github.com/Plazmaz/leaky-repo' && clear" Enter | ||
Sleep 1s | ||
Show | ||
|
||
Sleep 1s | ||
|
||
Type "# View findings in human-readable format with the `report` command." Sleep 0.5s Enter | ||
Type "# This example assumes you already have a datastore from scanning at `datastore.np`." Sleep 1s Enter | ||
|
||
Type "noseyparker report --color always | less -RS" Sleep 0.5s Enter | ||
Sleep 5s Type "q" |
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,18 @@ | ||
Hide | ||
Sleep 1s | ||
Type "noseyparker -q scan --git-url 'https://github.com/Plazmaz/leaky-repo' && clear" Enter | ||
Sleep 1s | ||
Show | ||
|
||
Sleep 1s | ||
|
||
Type "# View findings in JSON format with the `report --format json` command." Sleep 0.5s Enter | ||
Type "# You can redirect the output to a file using the `-o FILE` option." Sleep 0.5s Enter | ||
Type "# This example assumes you already have a datastore from scanning at `datastore.np`." Sleep 1s Enter | ||
|
||
Type "noseyparker report --format json -o findings.json" Sleep 0.5s Enter | ||
Sleep 1s | ||
|
||
Type "# You can pretty-print JSON using `jq`." Enter | ||
Type "jq -C . findings.json | less -RS" Enter | ||
Sleep 5 Type "q" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
#!/bin/zsh | ||
|
||
set -e | ||
|
||
rm -rf scratch gifs && mkdir scratch gifs | ||
|
||
for example in examples/*.tape; do | ||
echo "### $example" | ||
scratch_dir="scratch/$(basename "$example" .tape)" | ||
mkdir "$scratch_dir" | ||
|
||
preprocessed="$scratch_dir/input.tape" | ||
|
||
cat common-config.tape "$example" >"$preprocessed" | ||
|
||
(cd "$scratch_dir" && vhs input.tape && cp output.gif "../../gifs/$(basename "$example" .tape).gif") | ||
done | ||
|
||
# other examples to create: | ||
# - listing rules | ||
# - checking rules | ||
# - reporting in SARIF format | ||
# - reporting in JSONL format | ||
# - dumping the report JSON schema |