diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-02-20 01:48:17 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-02-20 03:30:54 -0500 |
commit | 83f89188161b38046b39124ffb45bbbd6fcb572f (patch) | |
tree | 05a68afe3ad0394b3383adec01e98225b0ba92d4 /src/vcs/mod.rs | |
parent | 0820849c2b6793f035bfcf7d5cd22dfbe9b45c25 (diff) | |
download | fancy-prompt-83f89188161b38046b39124ffb45bbbd6fcb572f.tar.gz fancy-prompt-83f89188161b38046b39124ffb45bbbd6fcb572f.zip |
add vcs support
Diffstat (limited to 'src/vcs/mod.rs')
-rw-r--r-- | src/vcs/mod.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vcs/mod.rs b/src/vcs/mod.rs new file mode 100644 index 0000000..02c2eb7 --- /dev/null +++ b/src/vcs/mod.rs @@ -0,0 +1,35 @@ +mod git; + +pub enum VcsType { + Git, +} + +#[derive(Debug,Copy,Clone)] +pub enum ActiveOperation { + None, + Merge, + Revert, + CherryPick, + Bisect, + Rebase, +} + +pub trait VcsInfo { + fn vcs(&self) -> VcsType; + fn has_modified_files(&self) -> bool; + fn has_staged_files(&self) -> bool; + fn has_new_files(&self) -> bool; + fn has_commits(&self) -> bool; + fn active_operation(&self) -> ActiveOperation; + fn branch(&self) -> Option<String>; + fn remote_branch_diff(&self) -> Option<(usize, usize)>; +} + +pub fn detect() -> Option<Box<VcsInfo>> { + if let Some(git) = git::detect() { + Some(git) + } + else { + None + } +} |