Skip to content
Snippets Groups Projects
Commit d1490adf authored by Blinningjr's avatar Blinningjr
Browse files

Implemented cli skeleton

parent 16b0c98f
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
structopt = { version = "0.3"}
......@@ -4,19 +4,54 @@ mod srp_analyser;
use common::*;
use srp_analyser::*;
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "srp_analysis", about = "Preforms srp analysis.")]
struct Opt {
/// Approximate preemptions
#[structopt(short, long)]
approx: bool,
/// Input file, example input if not present
#[structopt(parse(from_os_str))]
input: Option<PathBuf>,
/// Output file, stdout if not present
#[structopt(parse(from_os_str))]
output: Option<PathBuf>,
}
fn main() {
let tasks: Tasks = create_tasks();
println!("tasks {:?}", &tasks);
println!("tot_util {}", total_load_factor(&tasks));
fn main() {
let opt = Opt::from_args();
println!("{:?}", opt);
let tasks: Tasks = match opt.input {
Some(_file) => create_tasks(), // TODO: Implement so that the tasks can be read from file.
None => create_tasks(),
};
let (ip, tr) = pre_analysis(&tasks);
println!("ip: {:?}", ip);
println!("tr: {:?}", tr);
let analysis = analyse(&tasks, &ip, &tr, opt.approx);
match opt.output {
Some(_file) => (), // TODO: Implement so that the analysis can be saved to file.
None => {
println!("tasks {:?}", &tasks);
println!("tot_util {}", total_load_factor(&tasks));
println!("ip: {:?}", ip);
println!("tr: {:?}", tr);
let analysis = analyse(&tasks, &ip, &tr, true);
println!("Analysis {:#?}", analysis);
println!("Analysis {:#?}", analysis);
// TODO: Implement a nicer print out to stdout.
},
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment