Skip to content

Commit

Permalink
Support a wasm package
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Mar 1, 2022
1 parent 9b9bc3d commit b879a8e
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

A minimal library & CLI tool to provide similar name suggestions like "Did you mean?"
This library provides suggestion traits for all collection types in the standard library.
A WebAssembly package is also supported.

## Examples

Expand Down Expand Up @@ -95,6 +96,15 @@ To suggest keys, use `suggestion::SuggestKey` trait.
cargo install suggestion
```

#### WebAssembly

This application also provides a wasm package.
You can install it using [`wapm`](https://wapm.io/help/install) by the following command:

```bash
$ wapm install ken-matsui/suggest
```

### Usage

```bash
Expand All @@ -116,6 +126,13 @@ OPTIONS:
-V, --version Print version information
```
#### WebAssembly
```bash
$ wapm run suggest --help
...
```
### Examples
```bash
Expand All @@ -135,6 +152,76 @@ $ suggest paoc poac poacpp --distance 2
The `paoc` input is similar to `poac`.
```
#### WebAssembly
```bash
$ wapm run suggest instakk update install
The `instakk` input is similar to `install`.

$ wapm run suggest hoge update install
No similar name for the `hoge` input was found.

$ wapm run suggest install update install
The same value with the `install` input exists.

$ wapm run suggest paoc poac poacpp
No similar name for the `paoc` input was found.

$ wapm run suggest paoc poac poacpp --distance 2
The `paoc` input is similar to `poac`.
```
## Contribution
Contributions, including issues and pull requests, are very welcome.
### Build
```bash
$ cargo build
```
Or you can directly execute the binary:
```bash
$ cargo run
```
#### WebAssembly
```bash
$ rustup target add wasm32-wasi
$ cargo build --target wasm32-wasi
$ wasmer run target/wasm32-wasi/debug/suggest.wasm encode hello
```
### Test
This command can also test C API.
```bash
$ cargo build
$ cargo test
```
### Publish
#### [GitHub Releases](https://github.com/ken-matsui/base64-cli/tags)
```bash
$ git tag v0.1.0
$ git push origin v0.1.0
```
#### [crates.io](https://crates.io/)
```bash
$ cargo publish
```
#### [wapm.io](https://wapm.io/)
```bash
$ cargo build --release --target wasm32-wasi
$ wapm publish
```
20 changes: 20 additions & 0 deletions wapm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "ken-matsui/suggest"
version = "0.3.2"
description = "A CLI tool to provide similar name suggestions like \"Did you mean?\""
license = "MIT"
readme = "README.md"
repository = "https://github.com/ken-matsui/suggest"
homepage = "https://github.com/ken-matsui/suggest#readme"

[[module]]
name = "suggest"
source = "target/wasm32-wasi/release/suggest.wasm"
abi = "wasi"

[module.interfaces]
wasi = "0.1.0-unstable"

[[command]]
name = "suggest"
module = "suggest"

0 comments on commit b879a8e

Please sign in to comment.