extism / cli

The extism CLI is used to generate plugin scaffolding and manage Extism installations
BSD 3-Clause "New" or "Revised" License
19 stars 5 forks source link

Add shell command and persistent plugin #81

Closed bhelx closed 1 month ago

bhelx commented 1 month ago

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