Add fixes to reciprocal allocation, example cli, add move money

This commit is contained in:
Piv
2022-06-18 10:30:18 +09:30
parent 6db4a50125
commit efdf4af2de
4 changed files with 475 additions and 50 deletions

View File

@@ -1,3 +1,54 @@
fn main() {
println!("Hello, world!");
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[clap(name = "coster-rs")]
#[clap(author = "Pivato M. <mpivato4@gmail.com>")]
#[clap(version = "0.0.1")]
#[clap(about = "Simple, fast, efficient costing tool", long_about = None)]
struct Cli {
#[clap(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
move_money {
#[clap(short = 'r', long, parse(from_os_str), value_name = "FILE")]
rules: PathBuf,
#[clap(short, long, parse(from_os_str), value_name = "FILE")]
output: Option<PathBuf>,
},
allocate_overheads {
#[clap(short, long, parse(from_os_str), value_name = "FILE")]
rules: PathBuf,
#[clap(short, long, parse(from_os_str), value_name = "FILE")]
lines: PathBuf,
#[clap(short, long, parse(from_os_str), value_name = "FILE")]
output: Option<PathBuf>,
},
}
// TODO: Return error (implement the required trait to allow an error to be returned)
fn main() {
let cli = Cli::parse();
match cli.command {
Commands::move_money { rules, output } => move_money(),
Commands::allocate_overheads {
rules,
lines,
output,
} => allocate_overheads(),
}
}
fn move_money() {
// read rules, for each rule, inspect the files and
}
fn allocate_overheads() {}