diff options
Diffstat (limited to 'src/project.rs')
-rw-r--r-- | src/project.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/project.rs b/src/project.rs new file mode 100644 index 0000000..7471c66 --- /dev/null +++ b/src/project.rs @@ -0,0 +1,26 @@ +use crate::errors::BumperError; +use crate::rust::Rust; +use std::path::Path; + +pub enum ProjectKind { + Rust(Rust), +} + +impl ProjectKind { + pub fn detect<P: AsRef<Path>>(dirname: P) -> Result<ProjectKind, BumperError> { + let dirname = dirname.as_ref(); + + if let Ok(p) = Rust::new(dirname) { + return Ok(Self::Rust(p)); + } + + Err(BumperError::UnknownProjectKind(dirname.to_path_buf())) + } + + pub fn set_version(&mut self, version: &str) -> Result<(), BumperError> { + match self { + Self::Rust(ref mut rust) => rust.set_version(version)?, + } + Ok(()) + } +} |