Skip to content

Commit

Permalink
README: Use example instead directly embedding example.
Browse files Browse the repository at this point in the history
  • Loading branch information
realazthat committed Aug 23, 2024
1 parent 66af20d commit 1c1bd58
Show file tree
Hide file tree
Showing 13 changed files with 486 additions and 388 deletions.
336 changes: 0 additions & 336 deletions .github/README.example.terminal.svg

This file was deleted.

42 changes: 18 additions & 24 deletions .github/README.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,27 @@ npx playwright install firefox

Example:

{% set example_cmd='
npx excalidraw-brute-export-cli \\
-i ./examples/simple.excalidraw \\
--background 1 \\
--embed-scene 0 \\
--dark-mode 0 \\
--scale 1 \\
--format svg \\
-o "./.github/README.example.output.svg"
' | trim %}

```bash
# Use this command:
{{ example_cmd | safe }}
```

<!--{{ shell('bash -c \'%s\'' | format(example_cmd),
rich='README.example.terminal.svg',
rich_alt='Example output',
rich_bg_color='black',
rich_cols=120,
decomentify=True,
include_args=False) }}-->
<!--{{snippet('./examples/simple_example.sh',
start='# SNIPPET_START',
end='\n# SNIPPET_END',
backtickify='bash',
decomentify='nl')|trim}}-->

<!--{{ shell('cat ./.github/simple_example.log',
start=': ECHO_SNIPPET_START',
end='^.*: ECHO_SNIPPET_END',
regex='MULTILINE',
rich='README.simple_example.log.svg',
rich_alt='Output of `bash ./examples/simple_example.sh`',
rich_bg_color='black',
rich_term='xterm-256color',
rich_cols=160,
include_args=False,
decomentify='nl') }}-->

And the resulting image (svg):

<img src="./.github/README.example.output.svg" alt="Simple Excalidraw Diagram as a SVG" width="400" />
<img src="./examples/simple_example_output.svg" alt="Simple Excalidraw Diagram as a SVG" width="400" />

## 💻 Command Line Options

Expand Down
17 changes: 11 additions & 6 deletions .github/README.remotified.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,30 @@ npx playwright install firefox

Example:



<!---->
```bash
# Use this command:

npx excalidraw-brute-export-cli \
-i ./examples/simple.excalidraw \
--background 1 \
--embed-scene 0 \
--dark-mode 0 \
--scale 1 \
--format svg \
-o "./.github/README.example.output.svg"
-o "./examples/simple_example_output.svg"

ls "./examples/simple_example_output.svg"

```
<!---->

<!-- --><img alt="Example output" src="https://raw.githubusercontent.com/realazthat/excalidraw-brute-export-cli/v0.3.2/.github/README.example.terminal.svg"/><!-- -->
<!---->
<img alt="Output of `bash ./examples/simple_example.sh`" src="https://raw.githubusercontent.com/realazthat/excalidraw-brute-export-cli/v0.3.2/.github/README.simple_example.log.svg"/>
<!-- -->

And the resulting image (svg):

<img alt="Simple Excalidraw Diagram as a SVG" src="https://raw.githubusercontent.com/realazthat/excalidraw-brute-export-cli/v0.3.2/.github/README.example.output.svg" width="400"/>
<img alt="Simple Excalidraw Diagram as a SVG" src="https://raw.githubusercontent.com/realazthat/excalidraw-brute-export-cli/v0.3.2/examples/simple_example_output.svg" width="400"/>

## 💻 Command Line Options

Expand Down
367 changes: 367 additions & 0 deletions .github/README.simple_example.log.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions .github/simple_example.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
$ set -e -x -v -u -o pipefail
set +v
$ set +v
$ GREEN='\033[0;32m'
$ YELLOW='\033[1;33m'
$ NC='\033[0m'
$ PS4='\033[0;32m$ \033[0m'
$ EXCALIDRAW_BRUTE_EXPORT_CLI_URL=http://localhost:59876
$ [[ -z http://localhost:59876 ]]
$ : ECHO_SNIPPET_START
$ npx excalidraw-brute-export-cli -i ./examples/simple.excalidraw --background 1 --embed-scene 0 --dark-mode 0 --scale 1 --format svg -o ./examples/simple_example_output.svg
info: options:
info: {
i: './examples/simple.excalidraw',
input: './examples/simple.excalidraw',
background: true,
b: true,
embedScene: false,
e: false,
darkMode: false,
d: false,
scale: 1,
s: 1,
format: 'svg',
f: 'svg',
o: './examples/simple_example_output.svg',
output: './examples/simple_example_output.svg',
url: '',
excalidrawVersion: '',
headless: true,
leaveBrowserRunning: false,
screenshots: '',
actionSleepTime: 200,
timeout: -1
}
info: Falling back to environment variable EXCALIDRAW_BRUTE_EXPORT_CLI_URL
info: excalidrawURL: http://localhost:59876
info: Detecting Excalidraw version...
info: excalidrawVersion: 0.15.0
info: Clicking: Menu Burger
info: Clicking: Open Menu Item
info: File is chosen!
info: Clicking: Export Menu Item
info: await exportBackgroundSwitch.count(): 1
info: await exportEmbedSwitch.count(): 1
info: await exportScaleDiv.count(): 1
info: await exportScaleElements.count(): 3
info: Pressing SVG button!
info: File is downloaded!
info: closing...
$ ls ./examples/simple_example_output.svg
./examples/simple_example_output.svg
$ : ECHO_SNIPPET_END
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,30 @@ npx playwright install firefox

Example:



<!---->
```bash
# Use this command:

npx excalidraw-brute-export-cli \
-i ./examples/simple.excalidraw \
--background 1 \
--embed-scene 0 \
--dark-mode 0 \
--scale 1 \
--format svg \
-o "./.github/README.example.output.svg"
-o "./examples/simple_example_output.svg"

ls "./examples/simple_example_output.svg"

```
<!---->

<!----><img src=".github/README.example.terminal.svg" alt="Example output" /><!---->
<!---->
<img src=".github/README.simple_example.log.svg" alt="Output of `bash ./examples/simple_example.sh`" />
<!---->

And the resulting image (svg):

<img src="./.github/README.example.output.svg" alt="Simple Excalidraw Diagram as a SVG" width="400" />
<img src="./examples/simple_example_output.svg" alt="Simple Excalidraw Diagram as a SVG" width="400" />

## 💻 Command Line Options

Expand Down
8 changes: 4 additions & 4 deletions examples/local-docker_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ docker run --rm --tty \
my-excalidraw-brute-export-cli-image \
-i ./examples/simple.excalidraw \
--background 1 \
--embed-scene 1 \
--embed-scene 0 \
--dark-mode 0 \
--scale 1 \
--format png \
-o "./examples/simple_example_output.png"
--format svg \
-o "./examples/simple_example_output.svg"

ls "./examples/simple_example_output.png"
ls "./examples/simple_example_output.svg"

# SNIPPET_END
: ECHO_SNIPPET_END
8 changes: 4 additions & 4 deletions examples/remote-docker_example-noautorun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ docker run --rm --tty \
ghcr.io/realazthat/excalidraw-brute-export-cli:v0.3.2 \
-i ./examples/simple.excalidraw \
--background 1 \
--embed-scene 1 \
--embed-scene 0 \
--dark-mode 0 \
--scale 1 \
--format png \
-o "./examples/simple_example_output.png"
--format svg \
-o "./examples/simple_example_output.svg"

ls "./examples/simple_example_output.png"
ls "./examples/simple_example_output.svg"

# SNIPPET_END
: ECHO_SNIPPET_END
8 changes: 4 additions & 4 deletions examples/simple_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ fi
npx excalidraw-brute-export-cli \
-i ./examples/simple.excalidraw \
--background 1 \
--embed-scene 1 \
--embed-scene 0 \
--dark-mode 0 \
--scale 1 \
--format png \
-o "./examples/simple_example_output.png"
--format svg \
-o "./examples/simple_example_output.svg"

ls "./examples/simple_example_output.png"
ls "./examples/simple_example_output.svg"

# SNIPPET_END
: ECHO_SNIPPET_END
8 changes: 4 additions & 4 deletions examples/simple_example.sh.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ docker build -t {{docker_image_name|safe}} .
{{cmd|safe}} \
-i ./examples/simple.excalidraw \
--background 1 \
--embed-scene 1 \
--embed-scene 0 \
--dark-mode 0 \
--scale 1 \
--format png \
-o "./examples/simple_example_output.png"
--format svg \
-o "./examples/simple_example_output.svg"

ls "./examples/simple_example_output.png"
ls "./examples/simple_example_output.svg"

# SNIPPET_END
: ECHO_SNIPPET_END
Binary file removed examples/simple_example_output.png
Binary file not shown.
File renamed without changes
10 changes: 10 additions & 0 deletions scripts/generate-readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ NODE_VERSION_PATH=${PWD}/.nvmrc \

bash scripts/format.sh

(
# FORCE_COLOR and TERM are set, to produce consistent results across different
# systems.
#
Expand Down Expand Up @@ -55,10 +56,19 @@ export TERM=dumb
export CLI_WIDTH=120
export LINES=40
export COLUMNS=120


# Try to make terminal output as consistent as possible.
TERM=xterm-256color COLUMNS=160 LINES=40 \
PS4="${GREEN}$ ${NC}" unbuffer bash -x ./examples/simple_example.sh \
> .github/simple_example.log 2>&1


python -m snipinator.cli \
-t "${PROJ_PATH}/.github/README.md.jinja2" \
-o "${PROJ_PATH}/README.md" \
--rm --force --create --chmod-ro
)
################################################################################
LAST_VERSION=$(node -p "require('./package.json').version")
python -m mdremotifier.cli \
Expand Down

0 comments on commit 1c1bd58

Please sign in to comment.