Add log/env_logger, empty store module

This commit is contained in:
Jacob Hinkle 2022-10-13 12:55:27 -04:00
parent 4cd3b71839
commit dc2edcf0a3
5 changed files with 96 additions and 4 deletions

68
Cargo.lock generated
View File

@ -2,6 +2,15 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 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]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -19,6 +28,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.0.14" version = "4.0.14"
@ -56,6 +71,19 @@ dependencies = [
"os_str_bytes", "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]] [[package]]
name = "heck" name = "heck"
version = "0.4.0" version = "0.4.0"
@ -71,17 +99,40 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.135" version = "0.2.135"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" 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]] [[package]]
name = "nancy" name = "nancy"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"env_logger",
"log",
] ]
[[package]] [[package]]
@ -138,6 +189,23 @@ dependencies = [
"proc-macro2", "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]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"

View File

@ -19,3 +19,5 @@ path = "src/cli/main.rs"
[dependencies] [dependencies]
clap = { version = "4.0.14", features = ["derive"] } clap = { version = "4.0.14", features = ["derive"] }
env_logger = "0.9.1"
log = "0.4.17"

View File

@ -1,4 +1,5 @@
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use env_logger;
use nancy; use nancy;
// Composable provenance tracking for scientific data analysis // Composable provenance tracking for scientific data analysis
@ -11,23 +12,35 @@ struct Cli {
#[derive(Subcommand)] #[derive(Subcommand)]
enum Commands { 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 { Hello {
/// say hello from lib too?
#[arg(short, long)] #[arg(short, long)]
fromlib: bool, fromlib: bool,
}, },
} }
fn main() { fn main() {
env_logger::init();
let cli = Cli::parse(); let cli = Cli::parse();
match &cli.command { match &cli.command {
Some(Commands::Hello { fromlib }) => { Some(Commands::Hello { fromlib }) => {
println!("Hello from nancy (binary)!");
if *fromlib { if *fromlib {
nancy::say_hello(); 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 => {} None => {}
} }

View File

@ -1,3 +1,9 @@
use log;
mod store;
pub fn say_hello() { 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!!!");
} }

3
src/lib/store.rs Normal file
View File

@ -0,0 +1,3 @@
struct Store{
};