mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Make export blocks default to json on stdout (#5090)
* Make export blocks default to json on stdout * Multiline instead of single line to stay under 100 cols * Change --json flag to --binary, defaulting to json
This commit is contained in:
@@ -50,9 +50,9 @@ pub struct ExportBlocksCmd {
|
||||
#[structopt(long = "to", value_name = "BLOCK")]
|
||||
pub to: Option<BlockNumber>,
|
||||
|
||||
/// Use JSON output rather than binary.
|
||||
#[structopt(long = "json")]
|
||||
pub json: bool,
|
||||
/// Use binary output rather than JSON.
|
||||
#[structopt(long = "binary", value_name = "BOOL", parse(try_from_str), default_value("false"))]
|
||||
pub binary: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
@@ -85,7 +85,7 @@ impl ExportBlocksCmd {
|
||||
let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1);
|
||||
let to = self.to.as_ref().and_then(|t| t.parse().ok());
|
||||
|
||||
let json = self.json;
|
||||
let binary = self.binary;
|
||||
|
||||
let file: Box<dyn io::Write> = match &self.output {
|
||||
Some(filename) => Box::new(fs::File::create(filename)?),
|
||||
@@ -93,7 +93,7 @@ impl ExportBlocksCmd {
|
||||
};
|
||||
|
||||
run_until_exit(config, |config| {
|
||||
Ok(builder(config)?.export_blocks(file, from.into(), to, json))
|
||||
Ok(builder(config)?.export_blocks(file, from.into(), to, binary))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user