Skip to content

Conversation

bhelx
Copy link
Contributor

@bhelx bhelx commented May 11, 2024

This adds a shell command and persists the plugin across calls. This is helpful for testing a plugin with state. Example:

$ extism shell

> extism call /Users/ben/dylibso/js-pdk/examples/react.wasm render --wasi
<div style="background-color:lightblue"><p>Hello</p></div>
> extism call /Users/ben/dylibso/js-pdk/examples/react.wasm setState --input='{"type": "SET_SETTING", "payload": { "backgroundColor": "tomato" }}' --wasi
<div style="background-color:tomato"><p>Hello</p></div>
> extism call /Users/ben/dylibso/js-pdk/examples/react.wasm render --wasi
<div style="background-color:tomato"><p>Hello</p></div>

Note: I am aware of the loop flag but this allows more complicated scenarios

Copy link
Contributor

@zshipko zshipko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, seems like it will come in handy!

@bhelx bhelx merged commit 771bdf8 into main May 14, 2024
@bhelx bhelx deleted the extism-shell-command branch May 14, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants