refactor(git): started implementing validity check for repo kinds
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
c37cd42b7e
commit
d17f14be97
1 changed files with 38 additions and 0 deletions
38
src/git.rs
38
src/git.rs
|
@ -315,6 +315,44 @@ impl Repo {
|
|||
unimplemented!("This seems to easy to missuse/exploit");
|
||||
// fs::remove_dir_all(format!("{}{}", &self.path, &self.name))
|
||||
}
|
||||
fn check_is_valid_GitRepo(&self) -> bool {
|
||||
todo!();
|
||||
}
|
||||
fn check_is_valid_GitHubRepo(&self) -> bool {
|
||||
todo!();
|
||||
}
|
||||
fn check_is_valid_GitLabRepo(&self) -> bool {
|
||||
todo!();
|
||||
}
|
||||
fn check_is_valid_GiteaRepo(&self) -> bool {
|
||||
todo!();
|
||||
}
|
||||
fn check_is_valid_UrlRepo(&self) -> bool {
|
||||
todo!();
|
||||
}
|
||||
fn check_is_valid_Link(&self) -> bool {
|
||||
todo!();
|
||||
}
|
||||
/// Check if Repo is a valid instance of its kind
|
||||
pub fn is_valid_kind(&self) -> bool {
|
||||
use RepoKinds::*;
|
||||
match &self.kind {
|
||||
Some(GitRepo) => self.check_is_valid_GitRepo(),
|
||||
Some(GitHubRepo) => self.check_is_valid_GitHubRepo(),
|
||||
Some(GitLabRepo) => self.check_is_valid_GitLabRepo(),
|
||||
Some(GiteaRepo) => self.check_is_valid_GiteaRepo(),
|
||||
Some(UrlRepo) => self.check_is_valid_UrlRepo(),
|
||||
Some(Link) => self.check_is_valid_Link(),
|
||||
Some(kind) => {
|
||||
panic!("kind {kind:?} not implemented");
|
||||
false
|
||||
}
|
||||
None => {
|
||||
println!("unknown kind {:?}", self.kind);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn all_on_all(&self, closures: Vec<SeriesItem>, break_on_err: bool) {
|
||||
|
|
Loading…
Reference in a new issue