diff --git a/.gitignore b/.gitignore index 088ba6b..22d3516 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,8 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk + + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..3883011 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "imgffs" +version = "0.1.0" +authors = ["Víctor Martínez "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +name = "lib" + +[dependencies] +image = "0.23.12" +clap = "2.33.3" \ No newline at end of file diff --git a/mock/beach.jpg b/mock/beach.jpg new file mode 100644 index 0000000..9265582 Binary files /dev/null and b/mock/beach.jpg differ diff --git a/mock/chair.jpg b/mock/chair.jpg new file mode 100644 index 0000000..910bd8c Binary files /dev/null and b/mock/chair.jpg differ diff --git a/mock/tree.png b/mock/tree.png new file mode 100644 index 0000000..eb3673e Binary files /dev/null and b/mock/tree.png differ diff --git a/src/cli/mod.rs b/src/cli/mod.rs new file mode 100644 index 0000000..5868eb5 --- /dev/null +++ b/src/cli/mod.rs @@ -0,0 +1,28 @@ +use clap::{App, Arg}; + +const HELP_TEMPLATE: &str = "{bin} v{version} + +----------- + +{about} + +{all-args} + +----------- + +(C) 2020 {author} + +{after-help}"; + +/// This function builds the Command Line Application +/// already with its metadata, args boundaries etc. +pub fn build_cli() -> App<'static, 'static> { + App::new("Image Editor application") + .author(crate_authors!()) + .version(crate_version!()) + .about("Edit, transform, crop, rotate etc. an image with just one command") + .template(HELP_TEMPLATE) + .before_help("Thanks for using this app bro :)") + .after_help("Have a nice day!") + .arg(Arg::with_name("FILE").index(1).required(true)) +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..4785f10 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,4 @@ +#[macro_use] +extern crate clap; + +pub mod cli; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..877b445 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,10 @@ +extern crate clap; +extern crate image; + +use lib::cli; + +fn main() { + let matches = cli::build_cli().get_matches(); + +} +