]>
Commit | Line | Data |
---|---|---|
36a4680d | 1 | use std::fs::remove_file; |
d620665f | 2 | use std::io::Result; |
a9c6be41 | 3 | use crate::configuration::Configuration; |
d620665f RBR |
4 | |
5 | pub struct RemoveRemote; | |
6 | ||
7 | impl RemoveRemote { | |
8 | pub fn new() -> Self { | |
9 | RemoveRemote | |
10 | } | |
11 | } | |
12 | ||
13 | impl super::Command for RemoveRemote { | |
14 | fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> { | |
15 | vec![] | |
16 | } | |
17 | ||
36a4680d RBR |
18 | fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> { |
19 | if configuration.remote_config.exists() { | |
20 | remove_file(&configuration.remote_config)?; | |
21 | } | |
d620665f RBR |
22 | return Ok(()) |
23 | } | |
24 | ||
25 | fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> { | |
26 | vec![] | |
27 | } | |
28 | ||
29 | fn command(&self) -> &'static str { | |
30 | "remove-remote" | |
31 | } | |
32 | ||
33 | fn help(&self) -> &'static str { | |
34 | "\t\t\tRemoves the git remote" | |
35 | } | |
36 | } |