Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wapm-packages/cowsay
Cowsay in WebAssembly
https://github.com/wapm-packages/cowsay
Last synced: 6 days ago
JSON representation
Cowsay in WebAssembly
- Host: GitHub
- URL: https://github.com/wapm-packages/cowsay
- Owner: wapm-packages
- License: mit
- Created: 2019-04-06T00:57:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-28T08:28:26.000Z (over 1 year ago)
- Last Synced: 2024-08-02T06:11:31.208Z (3 months ago)
- Language: Rust
- Homepage: https://wasmer.io/syrusakbary/cowsay
- Size: 41 KB
- Stars: 40
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wasi - cowsay
README
# Cowsay
You can install cowsay with:
```shell
wasmer run cowsay hello
```*Note: This project is a fork of the original Rust implementation: [rust-cowsay](https://github.com/msmith491/rust-cowsay).*
## Running
```shell
$ wasmer run cowsay "This is a test run"
___________________
< This is a test run >
-------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
```Print help
```shell
$ wasmer run cowsay -h
cowsay v0.1.0
Syrus A.USAGE:
wasmer run cowsay [FLAGS] [OPTIONS] [MESSAGE]...FLAGS:
-b Borg Cow
-d Dead Cow
-g Greedy Cow
-h, --help Prints help information
-l, --list List Cows
-n Disable word wrap
-p Paranoid Cow
--random Choose random cow
-s Stoned Cow
-t Tired Cow
-V, --version Prints version information
-w Wired Cow
-y Youthful CowOPTIONS:
-f Which cow should say
-e Custom Eyes
-T Custom Tongue
-W Max width of cow text bubbleARGS:
... Message for cow to say
```### Included Cowfile
```shell
$ wasmer run cowsay -f tux "This is a test run"
___________________
< This is a test run >
-------------------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/
```### Custom Cowfile
```shell
$ wasmer run cowsay -f src/cows/elephant.cow "This is a test run"
___________________
< This is a test run >
-------------------
\ /\ ___ /\
\ // \/ \/ \\
(( O O ))
\\ / \ //
\/ | | \/
| | | |
| | | |
| o |
| | | |
|m| |m|
```## Building from Source
First, you will need the WASI target installed in your Rust system:
```shell
rustup target add wasm32-wasi
```Once WASI is available, you can build the WebAssembly binary by yourself with:
```shell
cargo build --release --target wasm32-wasi
```This will create a new file located at `target/wasm32-wasi/release/cowsay.wasm`.
When the wasm file is created you can upload it to wasmer or execute it with wasmer:
```shell
wasmer publish
# OR
wasmer run . "Hello World"
```You can also build a native executable with
```shell
cargo build
```