From 8b16296d5efa7dd060af42ead6561c4b0c4533eb Mon Sep 17 00:00:00 2001 From: Leo Drachenfeuer Date: Tue, 13 Dec 2022 05:02:02 +0100 Subject: [PATCH] refactor projekt to implement and test other cli libs --- Cargo.lock | 15 ++++++++++----- Cargo.toml | 12 +++++------- aoc/Cargo.toml | 6 ++++++ aoc/src/lib.rs | 4 ++++ {src => aoc/src}/util.rs | 0 {src/cli/commands => aoc/src/year2022}/day001.rs | 0 {src/cli/commands => aoc/src/year2022}/day002.rs | 0 {src/cli/commands => aoc/src/year2022}/day003.rs | 0 {src/cli/commands => aoc/src/year2022}/day004.rs | 0 {src/cli/commands => aoc/src/year2022}/day005.rs | 0 {src/cli/commands => aoc/src/year2022}/day006.rs | 0 {src/cli/commands => aoc/src/year2022}/day007.rs | 0 {src/cli/commands => aoc/src/year2022}/day008.rs | 0 {src/cli/commands => aoc/src/year2022}/day009.rs | 0 {src/cli/commands => aoc/src/year2022}/day010.rs | 0 {src/cli/commands => aoc/src/year2022}/day011.rs | 0 {src/cli/commands => aoc/src/year2022}/day012.rs | 0 {src/cli/commands => aoc/src/year2022}/day013.rs | 0 {src/cli/commands => aoc/src/year2022}/day014.rs | 0 {src/cli/commands => aoc/src/year2022}/day015.rs | 0 {src/cli/commands => aoc/src/year2022}/day016.rs | 0 {src/cli/commands => aoc/src/year2022}/day017.rs | 0 {src/cli/commands => aoc/src/year2022}/day018.rs | 0 {src/cli/commands => aoc/src/year2022}/day019.rs | 0 {src/cli/commands => aoc/src/year2022}/day020.rs | 0 {src/cli/commands => aoc/src/year2022}/day021.rs | 0 {src/cli/commands => aoc/src/year2022}/day022.rs | 0 {src/cli/commands => aoc/src/year2022}/day023.rs | 0 {src/cli/commands => aoc/src/year2022}/day024.rs | 0 {src/cli/commands => aoc/src/year2022}/day025.rs | 0 {src/cli/commands => aoc/src/year2022}/mod.rs | 0 aoc22-clap/Cargo.toml | 9 +++++++++ {src => aoc22-clap/src}/cli/mod.rs | 3 +-- {src => aoc22-clap/src}/main.rs | 1 - 34 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 aoc/Cargo.toml create mode 100644 aoc/src/lib.rs rename {src => aoc/src}/util.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day001.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day002.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day003.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day004.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day005.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day006.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day007.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day008.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day009.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day010.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day011.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day012.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day013.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day014.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day015.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day016.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day017.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day018.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day019.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day020.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day021.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day022.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day023.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day024.rs (100%) rename {src/cli/commands => aoc/src/year2022}/day025.rs (100%) rename {src/cli/commands => aoc/src/year2022}/mod.rs (100%) create mode 100644 aoc22-clap/Cargo.toml rename {src => aoc22-clap/src}/cli/mod.rs (98%) rename {src => aoc22-clap/src}/main.rs (82%) diff --git a/Cargo.lock b/Cargo.lock index 1990bf4..12577c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,9 +3,14 @@ version = 3 [[package]] -name = "adventofcode2022" +name = "aoc" +version = "2022.1.0" + +[[package]] +name = "aoc22-clap" version = "2022.1.0" dependencies = [ + "aoc", "clap", ] @@ -118,9 +123,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.137" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] name = "linux-raw-sys" @@ -184,9 +189,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23" +checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" dependencies = [ "bitflags", "errno", diff --git a/Cargo.toml b/Cargo.toml index 4de8ea2..482001c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,6 @@ -[package] -name = "adventofcode2022" -version = "2022.1.0" -edition = "2021" +[workspace] - -[dependencies] -clap = { version = "4.0.29", features = ["derive"] } +members = [ +"aoc22-clap", +"aoc" +] \ No newline at end of file diff --git a/aoc/Cargo.toml b/aoc/Cargo.toml new file mode 100644 index 0000000..8739003 --- /dev/null +++ b/aoc/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "aoc" +version = "2022.1.0" +edition = "2021" + +[dependencies] diff --git a/aoc/src/lib.rs b/aoc/src/lib.rs new file mode 100644 index 0000000..cd57476 --- /dev/null +++ b/aoc/src/lib.rs @@ -0,0 +1,4 @@ +pub mod year2022; +pub mod util; + +pub use year2022::*; diff --git a/src/util.rs b/aoc/src/util.rs similarity index 100% rename from src/util.rs rename to aoc/src/util.rs diff --git a/src/cli/commands/day001.rs b/aoc/src/year2022/day001.rs similarity index 100% rename from src/cli/commands/day001.rs rename to aoc/src/year2022/day001.rs diff --git a/src/cli/commands/day002.rs b/aoc/src/year2022/day002.rs similarity index 100% rename from src/cli/commands/day002.rs rename to aoc/src/year2022/day002.rs diff --git a/src/cli/commands/day003.rs b/aoc/src/year2022/day003.rs similarity index 100% rename from src/cli/commands/day003.rs rename to aoc/src/year2022/day003.rs diff --git a/src/cli/commands/day004.rs b/aoc/src/year2022/day004.rs similarity index 100% rename from src/cli/commands/day004.rs rename to aoc/src/year2022/day004.rs diff --git a/src/cli/commands/day005.rs b/aoc/src/year2022/day005.rs similarity index 100% rename from src/cli/commands/day005.rs rename to aoc/src/year2022/day005.rs diff --git a/src/cli/commands/day006.rs b/aoc/src/year2022/day006.rs similarity index 100% rename from src/cli/commands/day006.rs rename to aoc/src/year2022/day006.rs diff --git a/src/cli/commands/day007.rs b/aoc/src/year2022/day007.rs similarity index 100% rename from src/cli/commands/day007.rs rename to aoc/src/year2022/day007.rs diff --git a/src/cli/commands/day008.rs b/aoc/src/year2022/day008.rs similarity index 100% rename from src/cli/commands/day008.rs rename to aoc/src/year2022/day008.rs diff --git a/src/cli/commands/day009.rs b/aoc/src/year2022/day009.rs similarity index 100% rename from src/cli/commands/day009.rs rename to aoc/src/year2022/day009.rs diff --git a/src/cli/commands/day010.rs b/aoc/src/year2022/day010.rs similarity index 100% rename from src/cli/commands/day010.rs rename to aoc/src/year2022/day010.rs diff --git a/src/cli/commands/day011.rs b/aoc/src/year2022/day011.rs similarity index 100% rename from src/cli/commands/day011.rs rename to aoc/src/year2022/day011.rs diff --git a/src/cli/commands/day012.rs b/aoc/src/year2022/day012.rs similarity index 100% rename from src/cli/commands/day012.rs rename to aoc/src/year2022/day012.rs diff --git a/src/cli/commands/day013.rs b/aoc/src/year2022/day013.rs similarity index 100% rename from src/cli/commands/day013.rs rename to aoc/src/year2022/day013.rs diff --git a/src/cli/commands/day014.rs b/aoc/src/year2022/day014.rs similarity index 100% rename from src/cli/commands/day014.rs rename to aoc/src/year2022/day014.rs diff --git a/src/cli/commands/day015.rs b/aoc/src/year2022/day015.rs similarity index 100% rename from src/cli/commands/day015.rs rename to aoc/src/year2022/day015.rs diff --git a/src/cli/commands/day016.rs b/aoc/src/year2022/day016.rs similarity index 100% rename from src/cli/commands/day016.rs rename to aoc/src/year2022/day016.rs diff --git a/src/cli/commands/day017.rs b/aoc/src/year2022/day017.rs similarity index 100% rename from src/cli/commands/day017.rs rename to aoc/src/year2022/day017.rs diff --git a/src/cli/commands/day018.rs b/aoc/src/year2022/day018.rs similarity index 100% rename from src/cli/commands/day018.rs rename to aoc/src/year2022/day018.rs diff --git a/src/cli/commands/day019.rs b/aoc/src/year2022/day019.rs similarity index 100% rename from src/cli/commands/day019.rs rename to aoc/src/year2022/day019.rs diff --git a/src/cli/commands/day020.rs b/aoc/src/year2022/day020.rs similarity index 100% rename from src/cli/commands/day020.rs rename to aoc/src/year2022/day020.rs diff --git a/src/cli/commands/day021.rs b/aoc/src/year2022/day021.rs similarity index 100% rename from src/cli/commands/day021.rs rename to aoc/src/year2022/day021.rs diff --git a/src/cli/commands/day022.rs b/aoc/src/year2022/day022.rs similarity index 100% rename from src/cli/commands/day022.rs rename to aoc/src/year2022/day022.rs diff --git a/src/cli/commands/day023.rs b/aoc/src/year2022/day023.rs similarity index 100% rename from src/cli/commands/day023.rs rename to aoc/src/year2022/day023.rs diff --git a/src/cli/commands/day024.rs b/aoc/src/year2022/day024.rs similarity index 100% rename from src/cli/commands/day024.rs rename to aoc/src/year2022/day024.rs diff --git a/src/cli/commands/day025.rs b/aoc/src/year2022/day025.rs similarity index 100% rename from src/cli/commands/day025.rs rename to aoc/src/year2022/day025.rs diff --git a/src/cli/commands/mod.rs b/aoc/src/year2022/mod.rs similarity index 100% rename from src/cli/commands/mod.rs rename to aoc/src/year2022/mod.rs diff --git a/aoc22-clap/Cargo.toml b/aoc22-clap/Cargo.toml new file mode 100644 index 0000000..19afcd9 --- /dev/null +++ b/aoc22-clap/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "aoc22-clap" +version = "2022.1.0" +edition = "2021" + + +[dependencies] +clap = { version = "4.0.29", features = ["derive"] } +aoc = {path= "../aoc"} \ No newline at end of file diff --git a/src/cli/mod.rs b/aoc22-clap/src/cli/mod.rs similarity index 98% rename from src/cli/mod.rs rename to aoc22-clap/src/cli/mod.rs index a506aca..462e509 100644 --- a/src/cli/mod.rs +++ b/aoc22-clap/src/cli/mod.rs @@ -1,6 +1,5 @@ -mod commands; use clap::{arg, Parser, Subcommand}; -use commands::*; +use aoc::*; //use std::ffi::OsString; use std::path::PathBuf; diff --git a/src/main.rs b/aoc22-clap/src/main.rs similarity index 82% rename from src/main.rs rename to aoc22-clap/src/main.rs index 634bff3..11d70e6 100644 --- a/src/main.rs +++ b/aoc22-clap/src/main.rs @@ -1,4 +1,3 @@ -pub mod util; mod cli; use cli::execute_cli;