From 4fbc599d074180920b20ee46e80cc0d3669a4129 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Sat, 19 Nov 2022 00:14:58 +0100 Subject: [PATCH] Add clap crate to parse program arguments --- Cargo.lock | 89 +++++++++++++++++++++++++++++++++++++++++++--- backend/Cargo.toml | 11 +++--- 2 files changed, 92 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ebf8f8..ce67912 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,6 +393,43 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "clap" +version = "4.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" +dependencies = [ + "atty", + "bitflags", + "clap_derive", + "clap_lex", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "common" version = "0.1.0" @@ -677,6 +714,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -739,9 +782,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown", @@ -915,6 +958,12 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +[[package]] +name = "os_str_bytes" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" + [[package]] name = "parking_lot" version = "0.12.1" @@ -974,6 +1023,30 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.47" @@ -1051,6 +1124,7 @@ dependencies = [ "actix-web", "askama", "askama_actix", + "clap", "common", "env_logger", "futures", @@ -1060,6 +1134,7 @@ dependencies = [ "ron", "rusqlite", "serde", + "time", ] [[package]] @@ -1171,9 +1246,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" dependencies = [ "itoa", "ryu", @@ -1237,6 +1312,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" version = "1.0.103" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 7af3811..4c83bdc 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -7,10 +7,13 @@ edition = "2021" [dependencies] actix-web = "4" actix-files = "0.6" -serde = { version = "1.0", features = [ "derive" ] } +serde = {version = "1.0", features = ["derive"]} + +time = "0.3" ron = "0.8" # Rust object notation, to load configuration files. itertools = "0.10" +clap = {version = "4", features = ["derive"]} env_logger = "0.9" @@ -19,9 +22,9 @@ r2d2 = "0.8" futures = "0.3" # Needed by askam with the feature 'with-actix-web'. -common = { path = "../common" } +common = {path = "../common"} -askama = { version = "0.11", features = ["with-actix-web", "mime", "mime_guess"] } +askama = {version = "0.11", features = ["with-actix-web", "mime", "mime_guess"]} askama_actix = "0.13" -rusqlite = { version = "0.28", features = ["bundled"] } +rusqlite = {version = "0.28", features = ["bundled"]} -- 2.43.0