Update clap version and cli build

This commit is contained in:
michaelpivato
2022-10-20 12:36:49 +10:30
parent 28e3c87b98
commit 232ed9dd39
3 changed files with 25 additions and 48 deletions

40
Cargo.lock generated
View File

@@ -54,26 +54,24 @@ checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.5" version = "4.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7" checksum = "06badb543e734a2d6568e19a40af66ed5364360b9226184926f89d229b4b4267"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"indexmap",
"once_cell", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
"textwrap",
] ]
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.2.5" version = "4.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9" checksum = "c42f169caba89a7d512b5418b09864543eeb4d497416c917d7137863bd2076ad"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@@ -84,9 +82,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.2.2" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [ dependencies = [
"os_str_bytes", "os_str_bytes",
] ]
@@ -129,12 +127,6 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "hashbrown"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.0" version = "0.4.0"
@@ -150,16 +142,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "indexmap"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.10.3" version = "0.10.3"
@@ -312,9 +294,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.39" version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -400,12 +382,6 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.15.0" version = "1.15.0"

View File

@@ -14,6 +14,6 @@ csv = "1.1"
# simba = { version = "0.7.1", features = ["partial_fixed_point_support"] } # simba = { version = "0.7.1", features = ["partial_fixed_point_support"] }
# num = "0.4" # num = "0.4"
clap = { version = "3.1.18", features = ["derive"] } clap = { version = "4.0.17", features = ["derive"] }
itertools = "0.10.3" itertools = "0.10.3"

View File

@@ -3,33 +3,33 @@ use std::path::PathBuf;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
#[derive(Parser)] #[derive(Parser)]
#[clap(name = "coster-rs")] #[command(name = "coster-rs", author = "Pivato M. <mpivato4@gmail.com>", version = "0.0.1", about = "Simple, fast, efficient costing tool", long_about = None)]
#[clap(author = "Pivato M. <mpivato4@gmail.com>")]
#[clap(version = "0.0.1")]
#[clap(about = "Simple, fast, efficient costing tool", long_about = None)]
struct Cli { struct Cli {
#[clap(subcommand)] #[command(subcommand)]
command: Commands, command: Commands,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
enum Commands { enum Commands {
move_money { move_money {
#[clap(short = 'r', long, parse(from_os_str), value_name = "FILE")] #[arg(short = 'r', long, value_name = "FILE")]
rules: PathBuf, rules: PathBuf,
#[clap(short, long, parse(from_os_str), value_name = "FILE")] #[arg(short, long, value_name = "FILE")]
output: Option<PathBuf>, data: PathBuf,
#[arg(short, long, value_name = "FILE", default_value = "./output.csv")]
output: PathBuf,
}, },
allocate_overheads { allocate_overheads {
#[clap(short, long, parse(from_os_str), value_name = "FILE")] #[arg(short, long, value_name = "FILE")]
rules: PathBuf, rules: PathBuf,
#[clap(short, long, parse(from_os_str), value_name = "FILE")] #[arg(short, long, value_name = "FILE")]
lines: PathBuf, lines: PathBuf,
#[clap(short, long, parse(from_os_str), value_name = "FILE")] #[arg(short, long, value_name = "FILE", default_value = "./output.csv")]
output: Option<PathBuf>, output: PathBuf,
}, },
} }
@@ -38,7 +38,7 @@ fn main() {
let cli = Cli::parse(); let cli = Cli::parse();
match cli.command { match cli.command {
Commands::move_money { rules, output } => move_money(), Commands::move_money { rules, data, output } => move_money(rules, data, output),
Commands::allocate_overheads { Commands::allocate_overheads {
rules, rules,
lines, lines,
@@ -47,8 +47,9 @@ fn main() {
} }
} }
fn move_money() { fn move_money(rules: PathBuf, data: PathBuf, output: PathBuf) {
// read rules, for each rule, inspect the files and // Read all rules/data into memory (can figure out an alternative way later)
} }
fn allocate_overheads() {} fn allocate_overheads() {}