summaryrefslogtreecommitdiffstats
path: root/src/tabs
diff options
context:
space:
mode:
authorAlen Šiljak <dev@alensiljak.eu.org>2023-01-13 14:51:34 +0100
committerGitHub <noreply@github.com>2023-01-13 14:51:34 +0100
commit1dc097ebd87dbccc7ced46b6771aa21d69dee5a3 (patch)
treed0d8fc4869db1accaac6ba162e85b44007aa273f /src/tabs
parentb8a436fdebadccc852acdd3a9144bc18d842268b (diff)
Status view fetch (#1483)
* adding the command to Status view * cleanup and fix warnings Co-authored-by: extrawurst <mail@rusticorn.com>
Diffstat (limited to 'src/tabs')
-rw-r--r--src/tabs/status.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tabs/status.rs b/src/tabs/status.rs
index 84085a19..428daef0 100644
--- a/src/tabs/status.rs
+++ b/src/tabs/status.rs
@@ -594,6 +594,12 @@ impl Status {
}
}
+ fn fetch(&self) {
+ if self.can_pull() {
+ self.queue.push(InternalEvent::FetchRemotes);
+ }
+ }
+
fn pull(&self) {
if let Some(branch) = self.git_branch_name.last() {
self.queue.push(InternalEvent::Pull(branch));
@@ -761,6 +767,12 @@ impl Component for Status {
true,
self.can_push() && !focus_on_diff,
));
+
+ out.push(CommandInfo::new(
+ strings::commands::status_fetch(&self.key_config),
+ self.can_pull(),
+ !focus_on_diff,
+ ));
out.push(CommandInfo::new(
strings::commands::status_pull(&self.key_config),
self.can_pull(),
@@ -883,6 +895,12 @@ impl Component for Status {
{
self.push(false);
Ok(EventState::Consumed)
+ } else if key_match(k, self.key_config.keys.fetch)
+ && !self.is_focus_on_diff()
+ && self.can_pull()
+ {
+ self.fetch();
+ Ok(EventState::Consumed)
} else if key_match(k, self.key_config.keys.pull)
&& !self.is_focus_on_diff()
&& self.can_pull()