-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The info command can now be formatted as json
- Loading branch information
Showing
19 changed files
with
222 additions
and
186 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
subwasm-diff 0.4.0 | ||
subwasm-diff 0.5.0 | ||
chevdor <chevdor@gmail.com>:Wilfried Kopp <wilfried@parity.io | ||
Compare 2 runtimes | ||
|
||
USAGE: | ||
subwasm diff --a <a> --b <b> | ||
subwasm diff <a> <b> | ||
|
||
ARGS: | ||
<a> The first source | ||
<b> The second source | ||
|
||
FLAGS: | ||
-h, --help Prints help information | ||
-V, --version Prints version information | ||
|
||
OPTIONS: | ||
-a, --a <a> The first source | ||
-b, --b <b> The second source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
subwasm-info 0.4.0 | ||
subwasm-info 0.5.0 | ||
chevdor <chevdor@gmail.com>:Wilfried Kopp <wilfried@parity.io | ||
The `info` command returns summarized information about a runtime | ||
|
||
USAGE: | ||
subwasm info [FLAGS] [OPTIONS] | ||
subwasm info [FLAGS] [OPTIONS] [source] | ||
|
||
ARGS: | ||
<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] | ||
|
||
FLAGS: | ||
-d, --details-level Shows the list of modules if you provide `-d` | ||
-h, --help Prints help information | ||
-V, --version Prints version information | ||
|
||
OPTIONS: | ||
--chain <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 | ||
-s, --source <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] | ||
--chain <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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
subwasm-metadata 0.4.0 | ||
subwasm-metadata 0.5.0 | ||
chevdor <chevdor@gmail.com>:Wilfried Kopp <wilfried@parity.io | ||
Returns the metadata as a json object. You may also use the "meta" alias | ||
|
||
USAGE: | ||
subwasm metadata [OPTIONS] | ||
subwasm metadata [source] | ||
|
||
ARGS: | ||
<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] | ||
|
||
FLAGS: | ||
-h, --help Prints help information | ||
-V, --version Prints version information | ||
|
||
OPTIONS: | ||
-s, --source <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] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use std::fmt::Display; | ||
|
||
use num_format::{Locale, ToFormattedString}; | ||
use serde::Serialize; | ||
use wasm_testbed::WasmTestBed; | ||
|
||
#[derive(Debug, Serialize)] | ||
pub struct RuntimeInfo { | ||
size: usize, | ||
metadata_version: u8, | ||
core_version: String, | ||
proposal_hash: String, | ||
} | ||
|
||
impl RuntimeInfo { | ||
pub fn new(testbed: &WasmTestBed) -> Self { | ||
let core_version = match testbed.core_version() { | ||
Some(v) => v.to_string(), | ||
None => String::from("n/a"), | ||
}; | ||
|
||
Self { | ||
size: testbed.size(), | ||
metadata_version: *testbed.metadata_version(), | ||
core_version, | ||
proposal_hash: testbed.proposal_hash(), | ||
} | ||
} | ||
|
||
/// Print the RuntimeInfo either using the Display impl | ||
/// or serde as json. | ||
pub fn print(&self, json: bool) { | ||
if json { | ||
let serialized = serde_json::to_string_pretty(self).unwrap(); | ||
println!("{}", serialized); | ||
} else { | ||
println!("{}", self); | ||
} | ||
} | ||
} | ||
|
||
impl Display for RuntimeInfo { | ||
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
let size_mb: f64 = self.size as f64 / 1024.0 / 1024.0; | ||
writeln!(fmt, "🏋️ Runtime Size:\t{:.3?} MB ({} bytes)", size_mb, self.size.to_formatted_string(&Locale::en))?; | ||
writeln!(fmt, "🎁 Metadata version:\tV{:?}", self.metadata_version)?; | ||
writeln!(fmt, "🔥 Core version:\t{}", self.core_version)?; | ||
writeln!(fmt, "🗳️ Proposal hash:\t{}", self.proposal_hash) | ||
} | ||
} |
Oops, something went wrong.