From 7f7d829c93a20ed73ee3249841adf40ed15277d7 Mon Sep 17 00:00:00 2001 From: Adrian Malacoda Date: Mon, 18 Feb 2019 03:10:20 -0600 Subject: [PATCH] add a ProjectInfo struct, currently we don't parse any information into it so it just returns a placeholder --- scouter/src/lib.rs | 23 +++++++++++++++++++++++ src/main.rs | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/scouter/src/lib.rs b/scouter/src/lib.rs index c4ff95f..6b674c8 100644 --- a/scouter/src/lib.rs +++ b/scouter/src/lib.rs @@ -32,6 +32,29 @@ impl Project { pub fn path(&self) -> &Path { &self.path } + + pub fn info(&self) -> ProjectInfo { + match self.project_type { + ProjectType::Maven => ProjectInfo { + name: "placeholder".into(), + version: "placeholder".into() + }, + ProjectType::Npm => ProjectInfo { + name: "placeholder".into(), + version: "placeholder".into() + }, + ProjectType::Cargo => ProjectInfo { + name: "placeholder".into(), + version: "placeholder".into() + } + } + } +} + +#[derive(Debug)] +pub struct ProjectInfo { + pub name: String, + pub version: String } pub struct Scouter { diff --git a/src/main.rs b/src/main.rs index c26e0f6..e26b996 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ fn main() { let mut args = env::args(); args.next(); match args.next().as_ref().map(|arg| arg.as_str()) { - Some("info") => println!("{:?}", project), + Some("info") => println!("{:?}", project.info()), Some("where") => println!("{}", project.path().display()), Some("run") => { Command::new(args.next().unwrap())