diff --git a/src/compose.rs b/src/compose.rs new file mode 100644 index 0000000..ffccbd5 --- /dev/null +++ b/src/compose.rs @@ -0,0 +1,13 @@ +use std::path::PathBuf; + +pub struct ComposeProject { + compose_file: PathBuf, +} + +impl ComposeProject { + pub fn new(compose_file: &PathBuf) -> ComposeProject { + ComposeProject { + compose_file: compose_file.to_owned(), + } + } +} diff --git a/src/main.rs b/src/main.rs index ce4096c..efc4ac7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,10 @@ use glob::glob; use std::path::PathBuf; +use std::process::exit; use structopt::StructOpt; +mod compose; + #[derive(StructOpt, Debug)] #[structopt()] struct Opt { @@ -24,5 +27,18 @@ fn get_files(files: &[String]) -> Option> { fn main() { let opts = Opt::from_args(); - println!("{:?}", get_files(&opts.files)); + if opts.files.is_empty() { + println!("Must specify some files"); + exit(1); + } + let compose_files = match get_files(&opts.files) { + Some(f) => f, + None => exit(1), + }; + + let compose_projects: Vec = compose_files + .iter() + .map(compose::ComposeProject::new) + .collect(); + println!("Found {} projects", compose_projects.len()); }