Marine CLI
The Marine CLI provides a convenience wrapper over several of the Marine tools and utilities.
Installationโ
Install marine with:
shcargo +nightly install marine
shcargo +nightly install marine
List of commandsโ
The CLI functionality is available with:
shmarine --helpFluence Marine command line tool 0.12.7Fluence LabsUSAGE:marine [SUBCOMMAND]FLAGS:-h, --help Prints help information-V, --version Prints version informationSUBCOMMANDS:aqua Shows data types of provided module in a format suitable for Aquabuild Builds provided Rust project to Wasmgenerate Generates a template project for a Marine Wasm modulehelp Prints this message or the help of the given subcommand(s)info Shows manifest and sdk version of the provided Wasm fileit Shows IT of the provided Wasm filerepl Starts Fluence application service REPLset Sets interface types and version to the provided Wasm file
shmarine --helpFluence Marine command line tool 0.12.7Fluence LabsUSAGE:marine [SUBCOMMAND]FLAGS:-h, --help Prints help information-V, --version Prints version informationSUBCOMMANDS:aqua Shows data types of provided module in a format suitable for Aquabuild Builds provided Rust project to Wasmgenerate Generates a template project for a Marine Wasm modulehelp Prints this message or the help of the given subcommand(s)info Shows manifest and sdk version of the provided Wasm fileit Shows IT of the provided Wasm filerepl Starts Fluence application service REPLset Sets interface types and version to the provided Wasm file
aqua: show types in an Aqua-compatible wayโ
Shows all data types defined in a Marine module in the Aqua-compatible way:
shmarine help aquaUSAGE:marine aqua [OPTIONS] <in-wasm-path>OPTIONS:-i, --id <service-id> optional service id-s, --service <service-name> optional service nameARGS:<in-wasm-path> a path to a Wasm file
shmarine help aquaUSAGE:marine aqua [OPTIONS] <in-wasm-path>OPTIONS:-i, --id <service-id> optional service id-s, --service <service-name> optional service nameARGS:<in-wasm-path> a path to a Wasm file
shmarine aqua -i TestServiceId -s TestServiceName artifacts/records_effector.wasmmodule TestServiceName declares *data TestRecord:field_0: boolfield_1: i8field_2: i16field_3: i32field_4: i64field_5: u8field_6: u16field_7: u32field_8: u64field_9: f32field_10: f64field_11: stringfield_12: []u8service TestServiceName("TestServiceId"):mutate_struct(test_record: TestRecord) -> TestRecord
shmarine aqua -i TestServiceId -s TestServiceName artifacts/records_effector.wasmmodule TestServiceName declares *data TestRecord:field_0: boolfield_1: i8field_2: i16field_3: i32field_4: i64field_5: u8field_6: u16field_7: u32field_8: u64field_9: f32field_10: f64field_11: stringfield_12: []u8service TestServiceName("TestServiceId"):mutate_struct(test_record: TestRecord) -> TestRecord
build: compile Marine moduleโ
Compiles Rust project to a Marine Wasm module. Under the hood, it calls cargo build providing all given arguments, then compiles and embeds interface-types to compiled Wasm binary.
shmarine help buildUSAGE:marine build [optional]...ARGS:<optional>... cargo build arguments
shmarine help buildUSAGE:marine build [optional]...ARGS:<optional>... cargo build arguments
generate: generate Marine project templatesโ
Uses the power cargo-generate to generate a new project from this template. Note that cargo-generate should be installed (by cargo install cargo-generate) to use this subcommand.
shmarine help generateUSAGE:marine generate [FLAGS] [OPTIONS]FLAGS:-i, --init generate the template into the current dir without creating a new oneOPTIONS:-n, --name <generate-project-name> a project name; if the name isn't in kebab-case, it'll be converted to kebab-case
shmarine help generateUSAGE:marine generate [FLAGS] [OPTIONS]FLAGS:-i, --init generate the template into the current dir without creating a new oneOPTIONS:-n, --name <generate-project-name> a project name; if the name isn't in kebab-case, it'll be converted to kebab-case
info: prints embedded into Wasm file infoโ
The marine_manifest macro embeds some info into compiled Wasm module that could be obtained with this command:
shmarine info artifacts/greeting.wasmit version: 0.23.0sdk version: 0.6.0authors: Fluence Labsversion: 0.1.0description: The greeting module for the Fluence networkrepository: https://github.com/fluencelabs/marine/tree/master/examples/greetingbuild time: 2022-04-12 18:16:34.487366668 +00:00 UTC
shmarine info artifacts/greeting.wasmit version: 0.23.0sdk version: 0.6.0authors: Fluence Labsversion: 0.1.0description: The greeting module for the Fluence networkrepository: https://github.com/fluencelabs/marine/tree/master/examples/greetingbuild time: 2022-04-12 18:16:34.487366668 +00:00 UTC
it: shows interface-types of the Wasm binaryโ
Interface-types are embedded into a custom section of a Wasm binary while building with marine build
shmarine it artifacts/greeting.wasm(@interface it_version "0.23.0");; Types(@interface type (func(param $size: i32)(result i32))) ;; 0...;; Exports(@interface export "allocate" (func 0))(@interface export "release_objects" (func 1))...;; Implementations(@interface implement (func 12) (func 11))(@interface implement (func 14) (func 13))
shmarine it artifacts/greeting.wasm(@interface it_version "0.23.0");; Types(@interface type (func(param $size: i32)(result i32))) ;; 0...;; Exports(@interface export "allocate" (func 0))(@interface export "release_objects" (func 1))...;; Implementations(@interface implement (func 12) (func 11))(@interface implement (func 14) (func 13))
repl: run mreplโ
Runs the Marine REPL:
shmarine replWelcome to the Marine REPL (version 0.16.0)Minimal supported versionssdk: 0.6.0interface-types: 0.20.0app service was created with service id = aadec167-2a68-44de-b046-f5838ea77a77elapsed time 720.874ยฌยตs1>
shmarine replWelcome to the Marine REPL (version 0.16.0)Minimal supported versionssdk: 0.6.0interface-types: 0.20.0app service was created with service id = aadec167-2a68-44de-b046-f5838ea77a77elapsed time 720.874ยฌยตs1>
set: set IT or SDK versionโ
shmarine help setUSAGE:marine set [SUBCOMMAND]FLAGS:-h, --help Prints help information-V, --version Prints version informationSUBCOMMANDS:help Prints this message or the help of the given subcommand(s)it Sets given interface types to the provided Wasm fileversion Sets given sdk version to the provided Wasm file
shmarine help setUSAGE:marine set [SUBCOMMAND]FLAGS:-h, --help Prints help information-V, --version Prints version informationSUBCOMMANDS:help Prints this message or the help of the given subcommand(s)it Sets given interface types to the provided Wasm fileversion Sets given sdk version to the provided Wasm file
For example:
shmarine set version -i artifacts/greeting.wasm -v 0.7.0the version was successfully embedded
shmarine set version -i artifacts/greeting.wasm -v 0.7.0the version was successfully embedded
Lets check it worked:
shmarine info artifacts/greeting.wasmit version: 0.23.0sdk version: 0.7.0authors: Fluence Labsversion: 0.1.0description: The greeting module for the Fluence networkrepository: https://github.com/fluencelabs/marine/tree/master/examples/greetingbuild time: 2022-04-12 18:16:34.487366668 +00:00 UTC
shmarine info artifacts/greeting.wasmit version: 0.23.0sdk version: 0.7.0authors: Fluence Labsversion: 0.1.0description: The greeting module for the Fluence networkrepository: https://github.com/fluencelabs/marine/tree/master/examples/greetingbuild time: 2022-04-12 18:16:34.487366668 +00:00 UTC