diff --git a/.gitignore b/.gitignore index 9e33f44..ce698d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /target -# May wish to include this later since this is primarily a library, -# but ignoring it for early development +# This repo is primarily a library, so ignore Cargo.lock Cargo.lock # Backup files generated by rustfmt diff --git a/Cargo.toml b/Cargo.toml index a3ed748..a7e16fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,13 @@ version = "0.1.0" authors = ["Tom Alexander "] edition = "2018" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +name = "duster" +path = "src/lib.rs" + +[[bin]] +name = "duster-cli" +path = "src/bin.rs" [dependencies] nom = { git = "https://github.com/tomalexander/nom.git", branch = "take_until_parser_matches" } diff --git a/src/bin.rs b/src/bin.rs new file mode 100644 index 0000000..c03b9ed --- /dev/null +++ b/src/bin.rs @@ -0,0 +1,9 @@ +extern crate nom; +use parser::template; + +mod parser; + +fn main() { + let parsed_template = template("{#foo.bar}hello {name}{/foo.bar}!"); + println!("{:?}", parsed_template); +} diff --git a/src/main.rs b/src/lib.rs similarity index 68% rename from src/main.rs rename to src/lib.rs index 90d1ecc..a2ebd73 100644 --- a/src/main.rs +++ b/src/lib.rs @@ -1,5 +1,3 @@ extern crate nom; mod parser; - -fn main() {}