diff --git a/cli/src/main.rs b/cli/src/main.rs index ad99821..ade0cc7 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,6 +1,7 @@ mod opts; use clap::{crate_name, crate_version, Parser}; +// use color_eyre::owo_colors::OwoColorize; use env_logger::Env; use log::info; use opts::*; diff --git a/cli/src/opts.rs b/cli/src/opts.rs index 2c8f94c..e3c4922 100644 --- a/cli/src/opts.rs +++ b/cli/src/opts.rs @@ -5,7 +5,7 @@ use wasm_loader::{OnchainBlock, Source}; /// `subwasm` allows fetching, parsing and calling some methods on WASM runtimes of Substrate based chains. #[derive(Parser)] -#[clap(version = crate_version!(), author = crate_authors!(), color=ColorChoice::Always)] +#[clap(version = crate_version!(), author = crate_authors!(), color=ColorChoice::Auto)] pub struct Opts { /// Output as json #[clap(short, long, global = true)] @@ -138,23 +138,23 @@ pub struct MetaOpts { #[derive(Parser)] pub struct DiffOpts { /// The first source - #[clap(index = 1, alias = "src-a", default_value = "runtime_000.wasm", required_unless_present = "chain-a")] + #[clap(index = 1, alias = "src-a", default_value = "runtime_000.wasm", required_unless_present = "chain_a")] pub src_a: Source, /// Provide the name of a chain and a random url amongst a list of known nodes will be used. /// If you pass a valid --chain, --url will be ignored /// --chain local = http://localhost:9933 - #[clap(long, short('a'), conflicts_with = "src-a")] + #[clap(long, short('a'), conflicts_with = "src_a")] pub chain_a: Option, /// The second source - #[clap(index = 2, alias = "src-b", default_value = "runtime_001.wasm", required_unless_present = "chain-b")] + #[clap(index = 2, alias = "src-b", default_value = "runtime_001.wasm", required_unless_present = "chain_b")] pub src_b: Source, /// Provide the name of a chain and a random url amongst a list of known nodes will be used. /// If you pass a valid --chain, --url will be ignored /// --chain local = http://localhost:9933 - #[clap(long, short('b'), conflicts_with = "src-b")] + #[clap(long, short('b'), conflicts_with = "src_b")] pub chain_b: Option, } diff --git a/doc/usage.adoc b/doc/usage.adoc index 5d05678..5165253 100644 --- a/doc/usage.adoc +++ b/doc/usage.adoc @@ -1,28 +1,19 @@ -subwasm 0.18.0 -chevdor :Wilfried Kopp +Usage: subwasm [OPTIONS] -OPTIONS: - -h, --help Print help information - -j, --json Output as json - -q, --quiet Less output - -V, --version Print version information +Commands: + get Get/Download the runtime wasm from a running node through rpc + info The `info` command returns summarized information about a runtime + version The `version` command returns summarized information about the versions of a runtime + metadata Returns the metadata as a json object. You may also use the "meta" alias + diff Compare 2 runtimes + compress Compress a given runtime wasm file. You will get an error if you try compressing a runtime that is already compressed + decompress Decompress a given runtime wasm file. You may pass a runtime that is uncompressed already. In that case, you will get the same content as output. This is useful if you want to decompress "no matter what" and don't really know whether the input will be compressed or not + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - compress Compress a given runtime wasm file. You will get an error if you try - compressing a runtime that is already compressed - decompress Decompress a given runtime wasm file. You may pass a runtime that is - uncompressed already. In that case, you will get the same content as output. - This is useful if you want to decompress "no matter what" and don't really - know whether the input will be compressed or not - diff Compare 2 runtimes - get Get/Download the runtime wasm from a running node through rpc - help Print this message or the help of the given subcommand(s) - info The `info` command returns summarized information about a runtime - metadata Returns the metadata as a json object. You may also use the "meta" alias - version The `version` command returns summarized information about the versions of a - runtime +Options: + -j, --json Output as json + -q, --quiet Less output + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_compress.adoc b/doc/usage_compress.adoc index 9a36c1d..cd639b8 100644 --- a/doc/usage_compress.adoc +++ b/doc/usage_compress.adoc @@ -1,16 +1,12 @@ -subwasm-compress 0.18.0 -chevdor :Wilfried Kopp +Usage: subwasm compress [OPTIONS] -ARGS: - The path of uncompressed wasm file to load - The path of the file where the compressed runtime will be stored +Arguments: + The path of uncompressed wasm file to load + The path of the file where the compressed runtime will be stored -OPTIONS: - -h, --help Print help information - -j, --json Output as json - -V, --version Print version information +Options: + -j, --json Output as json + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_decompress.adoc b/doc/usage_decompress.adoc index 923bad2..d6f7d6a 100644 --- a/doc/usage_decompress.adoc +++ b/doc/usage_decompress.adoc @@ -1,17 +1,12 @@ -subwasm-decompress 0.18.0 -chevdor :Wilfried Kopp +Usage: subwasm decompress [OPTIONS] -ARGS: - The path of the compressed or uncompressed wasm file to load - The path of the file where the uncompressed runtime will be stored +Arguments: + The path of the compressed or uncompressed wasm file to load + The path of the file where the uncompressed runtime will be stored -OPTIONS: - -h, --help Print help information - -j, --json Output as json - -V, --version Print version information +Options: + -j, --json Output as json + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_diff.adoc b/doc/usage_diff.adoc index 25945ed..3b52fc2 100644 --- a/doc/usage_diff.adoc +++ b/doc/usage_diff.adoc @@ -1,21 +1,14 @@ -subwasm-diff 0.18.0 -chevdor :Wilfried Kopp The first source [default: runtime_000.wasm] - The second source [default: runtime_001.wasm] +Arguments: + [SRC_A] The first source [default: runtime_000.wasm] + [SRC_B] The second source [default: runtime_001.wasm] -OPTIONS: - -a, --chain-a Provide the name of a chain and a random url amongst a list of known - nodes will be used. If you pass a valid --chain, --url will be - ignored --chain local = http://localhost:9933 - -b, --chain-b Provide the name of a chain and a random url amongst a list of known - nodes will be used. If you pass a valid --chain, --url will be - ignored --chain local = http://localhost:9933 - -h, --help Print help information - -j, --json Output as json - -V, --version Print version information +Options: + -a, --chain-a Provide the name of a chain and a random url amongst a list of known nodes will be used. If you pass a valid --chain, --url will be ignored --chain local = http://localhost:9933 + -j, --json Output as json + -b, --chain-b Provide the name of a chain and a random url amongst a list of known nodes will be used. If you pass a valid --chain, --url will be ignored --chain local = http://localhost:9933 + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_get.adoc b/doc/usage_get.adoc index 2eafa41..df78602 100644 --- a/doc/usage_get.adoc +++ b/doc/usage_get.adoc @@ -1,27 +1,14 @@ -subwasm-get 0.18.0 -chevdor :Wilfried Kopp The node url including (mandatory) the port number. Example: ws://localhost:9944 or - http://localhost:9933 [default: http://localhost:9933] +Arguments: + [URL] The node url including (mandatory) the port number. Example: ws://localhost:9944 or http://localhost:9933 [default: http://localhost:9933] -OPTIONS: - -b, --block The optional block where to fetch the runtime. That allows fetching - older runtimes but you will need to connect to archive nodes. - Currently, you must pass a block hash. Passing the block numbers is not - supported - --chain Provide the name of a chain and a random url amongst a list of known - nodes will be used. If you pass a valid --chain, --url will be ignored - --chain local = http://localhost:9933 - -h, --help Print help information - -j, --json Output as json - -o, --output You may specifiy the output filename where the runtime will be saved. - If not provided, we will figure out an appropriate default name based - on a counter: runtime_NNN.wasm where NNN is incrementing to make sure - you do not override previous runtime. If you specify an existing file - as output, it will be overwritten - -V, --version Print version information +Options: + --chain Provide the name of a chain and a random url amongst a list of known nodes will be used. If you pass a valid --chain, --url will be ignored --chain local = http://localhost:9933 + -j, --json Output as json + -b, --block The optional block where to fetch the runtime. That allows fetching older runtimes but you will need to connect to archive nodes. Currently, you must pass a block hash. Passing the block numbers is not supported + -o, --output You may specifiy the output filename where the runtime will be saved. If not provided, we will figure out an appropriate default name based on a counter: runtime_NNN.wasm where NNN is incrementing to make sure you do not override previous runtime. If you specify an existing file as output, it will be overwritten + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_info.adoc b/doc/usage_info.adoc index 065c99e..ad9bc4d 100644 --- a/doc/usage_info.adoc +++ b/doc/usage_info.adoc @@ -1,22 +1,13 @@ -subwasm-info 0.18.0 -chevdor :Wilfried Kopp The wasm file to load. It can be a path on your local filesystem such as - /tmp/runtime.wasm or a node url such as http://localhost:9933 or - ws://localhost:9944 [default: runtime_000.wasm] +Arguments: + [SOURCE] The wasm file to load. It can be a path on your local filesystem such as /tmp/runtime.wasm or a node url such as http://localhost:9933 or ws://localhost:9944 [default: runtime_000.wasm] -OPTIONS: - -b, --block The optional block where to fetch the runtime. That allows fetching older - runtimes but you will need to connect to archive nodes. Currently, you - must pass a block hash. Passing the block numbers is not supported - --chain Provide the name of a chain and a random url amongst a list of known - nodes will be used. If you pass a valid --chain, --url will be ignored - --chain local = http://localhost:9933 - -h, --help Print help information - -j, --json Output as json - -V, --version Print version information +Options: + --chain Provide the name of a chain and a random url amongst a list of known nodes will be used. If you pass a valid --chain, --url will be ignored --chain local = http://localhost:9933 + -j, --json Output as json + -b, --block The optional block where to fetch the runtime. That allows fetching older runtimes but you will need to connect to archive nodes. Currently, you must pass a block hash. Passing the block numbers is not supported + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_meta.adoc b/doc/usage_meta.adoc index 19e7d5e..596cbf3 100644 --- a/doc/usage_meta.adoc +++ b/doc/usage_meta.adoc @@ -1,26 +1,14 @@ -subwasm-metadata 0.18.0 -chevdor :Wilfried Kopp The wasm file to load. It can be a path on your local filesystem such as - /tmp/runtime.wasm or a node url such as http://localhost:9933 or - ws://localhost:9944 [default: runtime_000.wasm] +Arguments: + [SOURCE] The wasm file to load. It can be a path on your local filesystem such as /tmp/runtime.wasm or a node url such as http://localhost:9933 or ws://localhost:9944 [default: runtime_000.wasm] -OPTIONS: - -b, --block The optional block where to fetch the runtime. That allows fetching - older runtimes but you will need to connect to archive nodes. - Currently, you must pass a block hash. Passing the block numbers is not - supported - --chain Provide the name of a chain and a random url amongst a list of known - nodes will be used. If you pass a valid --chain, --url will be ignored - --chain local = http://localhost:9933 - -h, --help Print help information - -j, --json Output as json - -m, --module Without this flag, the metadata command display the list of all - modules. Using this flag, you will only see the module of your choice - and a few details about it - -V, --version Print version information +Options: + --chain Provide the name of a chain and a random url amongst a list of known nodes will be used. If you pass a valid --chain, --url will be ignored --chain local = http://localhost:9933 + -j, --json Output as json + -m, --module Without this flag, the metadata command display the list of all modules. Using this flag, you will only see the module of your choice and a few details about it + -b, --block The optional block where to fetch the runtime. That allows fetching older runtimes but you will need to connect to archive nodes. Currently, you must pass a block hash. Passing the block numbers is not supported + -h, --help Print help information + -V, --version Print version information diff --git a/doc/usage_version.adoc b/doc/usage_version.adoc index c2e20f3..b25c7a9 100644 --- a/doc/usage_version.adoc +++ b/doc/usage_version.adoc @@ -1,22 +1,13 @@ -subwasm-version 0.18.0 -chevdor :Wilfried Kopp The wasm file to load. It can be a path on your local filesystem such as - /tmp/runtime.wasm or a node url such as http://localhost:9933 or - ws://localhost:9944 [default: runtime_000.wasm] +Arguments: + [SOURCE] The wasm file to load. It can be a path on your local filesystem such as /tmp/runtime.wasm or a node url such as http://localhost:9933 or ws://localhost:9944 [default: runtime_000.wasm] -OPTIONS: - -b, --block The optional block where to fetch the runtime. That allows fetching older - runtimes but you will need to connect to archive nodes. Currently, you - must pass a block hash. Passing the block numbers is not supported - --chain Provide the name of a chain and a random url amongst a list of known - nodes will be used. If you pass a valid --chain, --url will be ignored - --chain local = http://localhost:9933 - -h, --help Print help information - -j, --json Output as json - -V, --version Print version information +Options: + --chain Provide the name of a chain and a random url amongst a list of known nodes will be used. If you pass a valid --chain, --url will be ignored --chain local = http://localhost:9933 + -j, --json Output as json + -b, --block The optional block where to fetch the runtime. That allows fetching older runtimes but you will need to connect to archive nodes. Currently, you must pass a block hash. Passing the block numbers is not supported + -h, --help Print help information + -V, --version Print version information