From 5b83c0b65378a2c7f6a4652de71625b0ce20c88e Mon Sep 17 00:00:00 2001 From: DrPeterVanNostrand Date: Wed, 5 Aug 2020 17:13:23 -0400 Subject: [PATCH] feat: phase2-cli parse command --- filecoin-proofs/src/bin/phase2.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/filecoin-proofs/src/bin/phase2.rs b/filecoin-proofs/src/bin/phase2.rs index 0ee28683f..60d3315b8 100644 --- a/filecoin-proofs/src/bin/phase2.rs +++ b/filecoin-proofs/src/bin/phase2.rs @@ -1419,6 +1419,14 @@ fn main() { .help("The path to the file that contains all the data."), ); + let parse_command = SubCommand::with_name("parse") + .about("Parses file info from large or small-nonraw params") + .arg( + Arg::with_name("path") + .required(true) + .help("Path to params file."), + ); + let matches = App::new("phase2") .version("1.0") .setting(AppSettings::ArgRequiredElseHelp) @@ -1431,6 +1439,7 @@ fn main() { .subcommand(convert_command) .subcommand(merge_command) .subcommand(split_keys_command) + .subcommand(parse_command) .get_matches(); if let (subcommand, Some(matches)) = matches.subcommand() { @@ -1967,6 +1976,22 @@ fn main() { .unwrap_or_else(|_| panic!("failed to write info data to {}", info_path)); } } + "parse" => { + let path = matches.value_of("path").unwrap(); + let (_, _, _, _, _, size, raw) = parse_params_filename(&path); + + if raw { + unimplemented!("`parse` command does not currently support raw params"); + } + + let file_info = if size.is_large() { + FileInfo::parse_large(&path) + } else { + FileInfo::parse_small(&path) + }; + + println!("{:#?}", file_info); + } _ => unreachable!(), } }