add a ProjectInfo struct, currently we don't parse any information into it so it just returns a placeholder
This commit is contained in:
parent
a8c7cdf53b
commit
7f7d829c93
@ -32,6 +32,29 @@ impl Project {
|
|||||||
pub fn path(&self) -> &Path {
|
pub fn path(&self) -> &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 {
|
pub struct Scouter {
|
||||||
|
@ -12,7 +12,7 @@ fn main() {
|
|||||||
let mut args = env::args();
|
let mut args = env::args();
|
||||||
args.next();
|
args.next();
|
||||||
match args.next().as_ref().map(|arg| arg.as_str()) {
|
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("where") => println!("{}", project.path().display()),
|
||||||
Some("run") => {
|
Some("run") => {
|
||||||
Command::new(args.next().unwrap())
|
Command::new(args.next().unwrap())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user