Add fixes to reciprocal allocation, example cli, add move money
This commit is contained in:
55
src/main.rs
55
src/main.rs
@@ -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() {}
|
||||
|
||||
Reference in New Issue
Block a user