diff --git a/Cargo.lock b/Cargo.lock index 5afa9fb..85daf31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + [[package]] name = "atty" version = "0.2.14" @@ -19,6 +28,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "clap" version = "4.0.14" @@ -56,6 +71,19 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "env_logger" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "heck" version = "0.4.0" @@ -71,17 +99,40 @@ dependencies = [ "libc", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "libc" version = "0.2.135" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + [[package]] name = "nancy" version = "0.1.0" dependencies = [ "clap", + "env_logger", + "log", ] [[package]] @@ -138,6 +189,23 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + [[package]] name = "strsim" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index 879e78e..f89b9a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,5 @@ path = "src/cli/main.rs" [dependencies] clap = { version = "4.0.14", features = ["derive"] } +env_logger = "0.9.1" +log = "0.4.17" diff --git a/src/cli/main.rs b/src/cli/main.rs index 175a709..764d308 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -1,4 +1,5 @@ use clap::{Parser, Subcommand}; +use env_logger; use nancy; // Composable provenance tracking for scientific data analysis @@ -11,23 +12,35 @@ struct Cli { #[derive(Subcommand)] enum Commands { - /// just says hello + /// Record changes to a store directory (or a new store) + Record { + }, + /// Check for changes in store and print basic statistics + Status { + }, + /// Just say hello Hello { - /// say hello from lib too? #[arg(short, long)] fromlib: bool, }, } fn main() { + env_logger::init(); let cli = Cli::parse(); match &cli.command { Some(Commands::Hello { fromlib }) => { + println!("Hello from nancy (binary)!"); if *fromlib { nancy::say_hello(); } - println!("Hello from nancy (binary)!") + } + Some(Commands::Record { }) => { + println!("Record not yet implemented"); + } + Some(Commands::Status { }) => { + println!("Status not yet implemented"); } None => {} } diff --git a/src/lib/main.rs b/src/lib/main.rs index f2e75fa..bf0dcf3 100644 --- a/src/lib/main.rs +++ b/src/lib/main.rs @@ -1,3 +1,9 @@ +use log; + +mod store; + pub fn say_hello() { - println!("Hello from libnancy.rlib!"); + log::trace!("enter say_hello()"); + println!("If you see nothing in the next line, set RUST_LOG to info or lower"); + log::info!("Hello from libnancy.rlib!!!"); } diff --git a/src/lib/store.rs b/src/lib/store.rs new file mode 100644 index 0000000..4ffbb3a --- /dev/null +++ b/src/lib/store.rs @@ -0,0 +1,3 @@ +struct Store{ +}; +