diff --git a/Cargo.lock b/Cargo.lock index 5388f8f..ee54ba5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,26 +54,24 @@ checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" [[package]] name = "clap" -version = "3.2.5" +version = "4.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7" +checksum = "06badb543e734a2d6568e19a40af66ed5364360b9226184926f89d229b4b4267" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.5" +version = "4.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9" +checksum = "c42f169caba89a7d512b5418b09864543eeb4d497416c917d7137863bd2076ad" dependencies = [ "heck", "proc-macro-error", @@ -84,9 +82,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] @@ -129,12 +127,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "hashbrown" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" - [[package]] name = "heck" version = "0.4.0" @@ -150,16 +142,6 @@ dependencies = [ "libc", ] -[[package]] -name = "indexmap" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "itertools" version = "0.10.3" @@ -312,9 +294,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -400,12 +382,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" - [[package]] name = "typenum" version = "1.15.0" diff --git a/Cargo.toml b/Cargo.toml index d3c8ea2..12a6e24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,6 @@ csv = "1.1" # simba = { version = "0.7.1", features = ["partial_fixed_point_support"] } # num = "0.4" -clap = { version = "3.1.18", features = ["derive"] } +clap = { version = "4.0.17", features = ["derive"] } itertools = "0.10.3" diff --git a/src/main.rs b/src/main.rs index 5fc9da8..3d66f81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,33 +3,33 @@ use std::path::PathBuf; use clap::{Parser, Subcommand}; #[derive(Parser)] -#[clap(name = "coster-rs")] -#[clap(author = "Pivato M. ")] -#[clap(version = "0.0.1")] -#[clap(about = "Simple, fast, efficient costing tool", long_about = None)] +#[command(name = "coster-rs", author = "Pivato M. ", version = "0.0.1", about = "Simple, fast, efficient costing tool", long_about = None)] struct Cli { - #[clap(subcommand)] + #[command(subcommand)] command: Commands, } #[derive(Subcommand)] enum Commands { move_money { - #[clap(short = 'r', long, parse(from_os_str), value_name = "FILE")] + #[arg(short = 'r', long, value_name = "FILE")] rules: PathBuf, - #[clap(short, long, parse(from_os_str), value_name = "FILE")] - output: Option, + #[arg(short, long, value_name = "FILE")] + data: PathBuf, + + #[arg(short, long, value_name = "FILE", default_value = "./output.csv")] + output: PathBuf, }, allocate_overheads { - #[clap(short, long, parse(from_os_str), value_name = "FILE")] + #[arg(short, long, value_name = "FILE")] rules: PathBuf, - #[clap(short, long, parse(from_os_str), value_name = "FILE")] + #[arg(short, long, value_name = "FILE")] lines: PathBuf, - #[clap(short, long, parse(from_os_str), value_name = "FILE")] - output: Option, + #[arg(short, long, value_name = "FILE", default_value = "./output.csv")] + output: PathBuf, }, } @@ -38,7 +38,7 @@ fn main() { let cli = Cli::parse(); match cli.command { - Commands::move_money { rules, output } => move_money(), + Commands::move_money { rules, data, output } => move_money(rules, data, output), Commands::allocate_overheads { rules, lines, @@ -47,8 +47,9 @@ fn main() { } } -fn move_money() { - // read rules, for each rule, inspect the files and +fn move_money(rules: PathBuf, data: PathBuf, output: PathBuf) { + // Read all rules/data into memory (can figure out an alternative way later) + } fn allocate_overheads() {}