diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-11 19:41:57 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-11 19:41:57 -0500 |
commit | eec52f6845e2ca32435d72cd69dd21048c37c70b (patch) | |
tree | 450766dd196d68050227318041bffed66e190e83 /src/shell/event.rs | |
parent | 88080132e8778ef7196c7a8fc30434a8a21d11ba (diff) | |
download | nbsh-eec52f6845e2ca32435d72cd69dd21048c37c70b.tar.gz nbsh-eec52f6845e2ca32435d72cd69dd21048c37c70b.zip |
add git info to the prompt
Diffstat (limited to 'src/shell/event.rs')
-rw-r--r-- | src/shell/event.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shell/event.rs b/src/shell/event.rs index 9885821..9157c5e 100644 --- a/src/shell/event.rs +++ b/src/shell/event.rs @@ -6,6 +6,7 @@ pub enum Event { PtyClose, ChildRunPipeline(usize, (usize, usize)), ChildSuspend(usize), + GitInfo(Option<super::git::Info>), ClockTimer, } @@ -59,6 +60,7 @@ struct Pending { pty_close: bool, child_run_pipeline: std::collections::VecDeque<(usize, (usize, usize))>, child_suspend: std::collections::VecDeque<usize>, + git_info: Option<Option<super::git::Info>>, clock_timer: bool, done: bool, } @@ -76,6 +78,7 @@ impl Pending { || self.pty_close || !self.child_run_pipeline.is_empty() || !self.child_suspend.is_empty() + || self.git_info.is_some() || self.clock_timer } @@ -99,6 +102,9 @@ impl Pending { if let Some(idx) = self.child_suspend.pop_front() { return Some(Event::ChildSuspend(idx)); } + if let Some(info) = self.git_info.take() { + return Some(Event::GitInfo(info)); + } if self.clock_timer { self.clock_timer = false; return Some(Event::ClockTimer); @@ -125,6 +131,7 @@ impl Pending { Some(Event::ChildSuspend(idx)) => { self.child_suspend.push_back(idx); } + Some(Event::GitInfo(info)) => self.git_info = Some(info), Some(Event::ClockTimer) => self.clock_timer = true, None => self.done = true, } |