-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
ee19d05
commit 2ccaabf
Showing
5 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::fs; | ||
use std::io; | ||
|
||
use crate::utils::get_current_branch::get_current_branch; | ||
|
||
pub fn delete(branch_to_delete: &str) -> io::Result<()> { | ||
if branch_to_delete == "." { | ||
let _ = fs::remove_dir_all(".vault"); | ||
let _ = fs::remove_file(".vaultignore"); | ||
} else { | ||
let current_branch: Result<String, io::Error> = get_current_branch(); | ||
match current_branch { | ||
Ok(current_branch) => { | ||
if current_branch == branch_to_delete { | ||
panic!("You can not delete an Active Branch!") | ||
} else { | ||
//@TODO - Get add branches and check if the branch actually exists | ||
} | ||
} | ||
Err(e) => { | ||
panic!("Some Error Occurred: {e}") | ||
} | ||
} | ||
} | ||
panic!("Some unknown error occurred!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters