Extism CLI
The extism
CLI is a useful but optional tool
for developing with Extism. It handles a few things such as installing the
shared library (Extism Runtime), or invoking plug-ins from the command line.
The following instructions will walk you through how to install the Extism CLI, and then the installation of the shared library which a Host SDK will look for automatically.
Install the Extism CLI
curl -s https://get.extism.org/cli | sh
Or to a specific path:
curl -s https://get.extism.org/cli | sh -s -- -o $HOME/.local/bin
See the help output for more information:
curl -s https://get.extism.org/cli | sh -s -- -h
Releases are also available on Github: https://github.com/extism/cli/releases
you may need to remove it:
pip3 uninstall extism_cli --break-system-packages
which extism # shouldn't print anything, if it does, delete it
Using the Extism CLI
The most common use-case is to to install Extism from Github releases, and then
install the library and header file into the installation prefix of your choice.
The default prefix is /usr/local
, so libraries will be installed to
/usr/local/lib
and the header will be installed to /usr/local/include
.
install the runtime separately. If your language needs you to install the runtime, the SDKs readme will say so in the install instructions. :::
sudo extism lib install
tell sudo to use the PATH defined for your user with:
sudo -E env "PATH=$PATH" extism lib install
:::
Installing the latest from git
It's also possible to install the latest build from the main
git branch:
sudo extism lib install --version git
Overriding install location
Pass the --prefix
argument a path on disk where extism
CLI will install the
system files:
extism lib install --prefix ~/.local
Generating Plugin PDK Starters
You can use the Extism CLI to quickly start a new plugin project:
extism generate plugin -o new-plugin
Select a PDK language to use for your plugin:
> 1. Rust
2. JavaScript
3. Go
4. Zig
5. C#
6. F#
7. C
8. Haskell
9. AssemblyScript
Other CLI Features
Usage:
extism [command]
Available Commands:
call Call a plugin function
completion Generate the autocompletion script for the specified shell
help Help about any command
lib Manage libextism
Flags:
--github-token string Github access token, can also be set using the $GITHUB_TOKEN env variable
-h, --help help for extism
-q, --quiet Enable additional logging
-v, --verbose Enable additional logging
--version version for extism
Use "extism [command] --help" for more information about a command.
Call plug-in functions
You can use the extism
CLI as a test runner to check your plug-ins outside of
any Host program:
extism call --input "this is a test" test/code.wasm count_vowels
{"count": 4}
Check installed version
The CLI can also be used to get information about the installed version of libextism:
extism lib check
v0.5.0