Replace StructOpt with argh for comp.time+space
This commit is contained in:
parent
ff9a477b67
commit
00fcdf1031
|
@ -12,8 +12,8 @@ hdf5 = "0.7.0"
|
|||
integrate = { path = "../utils/integrate" }
|
||||
rayon = "1.3.0"
|
||||
indicatif = "0.15.0"
|
||||
structopt = "0.3.14"
|
||||
ndarray = { version = "0.14.0", features = ["serde"] }
|
||||
serde = { version = "1.0.115", features = ["derive"] }
|
||||
json5 = "0.3.0"
|
||||
indexmap = { version = "1.5.2", features = ["serde-1"] }
|
||||
argh = "0.1.4"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use argh::FromArgs;
|
||||
use rayon::prelude::*;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use sbp::operators::SbpOperator2d;
|
||||
use sbp::*;
|
||||
|
@ -180,30 +180,36 @@ impl System {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
struct Options {
|
||||
#[derive(Debug, FromArgs)]
|
||||
/// Options for configuring and running the solver
|
||||
struct CliOptions {
|
||||
#[argh(positional)]
|
||||
json: std::path::PathBuf,
|
||||
/// Disable the progressbar
|
||||
#[structopt(long)]
|
||||
no_progressbar: bool,
|
||||
/// Number of simultaneous threads
|
||||
#[structopt(short, long)]
|
||||
/// number of simultaneous threads
|
||||
#[argh(option, short = 'j')]
|
||||
jobs: Option<usize>,
|
||||
/// Name of output file
|
||||
#[structopt(default_value = "output.hdf", long, short)]
|
||||
/// name of output file
|
||||
#[argh(
|
||||
option,
|
||||
short = 'o',
|
||||
default = "std::path::PathBuf::from(\"output.hdf\")"
|
||||
)]
|
||||
output: std::path::PathBuf,
|
||||
/// Number of outputs to save
|
||||
#[structopt(long, short)]
|
||||
/// number of outputs to save
|
||||
#[argh(option, short = 'n')]
|
||||
number_of_outputs: Option<u64>,
|
||||
/// Print the time to complete, taken in the compute loop
|
||||
#[structopt(long)]
|
||||
/// print the time to complete, taken in the compute loop
|
||||
#[argh(switch)]
|
||||
timings: bool,
|
||||
/// Print error at the end of the run
|
||||
#[structopt(long)]
|
||||
/// print error at the end of the run
|
||||
#[argh(switch)]
|
||||
error: bool,
|
||||
/// Output information regarding time elapsed and error
|
||||
/// disable the progressbar
|
||||
#[argh(switch)]
|
||||
no_progressbar: bool,
|
||||
/// output information regarding time elapsed and error
|
||||
/// in json format
|
||||
#[structopt(long)]
|
||||
#[argh(switch)]
|
||||
output_json: bool,
|
||||
}
|
||||
|
||||
|
@ -217,7 +223,7 @@ struct OutputInformation {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let opt = Options::from_args();
|
||||
let opt: CliOptions = argh::from_env();
|
||||
let filecontents = std::fs::read_to_string(&opt.json).unwrap();
|
||||
|
||||
let config: parsing::Configuration = match json5::from_str(&filecontents) {
|
||||
|
|
Loading…
Reference in New Issue