mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-22 10:55:00 +00:00
feature: Display notification with remote message during push
Relates to #1170
This commit is contained in:
parent
61a1b130f2
commit
c14ac81638
1 changed files with 21 additions and 0 deletions
|
@ -1,4 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Avalonia.Threading;
|
||||||
|
|
||||||
namespace SourceGit.Commands
|
namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
|
@ -39,11 +42,29 @@ namespace SourceGit.Commands
|
||||||
Args += $"{remote} {refname}";
|
Args += $"{remote} {refname}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new bool Exec()
|
||||||
|
{
|
||||||
|
if (!base.Exec())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_remoteMessage.Count > 0)
|
||||||
|
{
|
||||||
|
Dispatcher.UIThread.Post(() => App.SendNotification(Context, string.Join("\n", _remoteMessage)));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnReadline(string line)
|
protected override void OnReadline(string line)
|
||||||
{
|
{
|
||||||
|
if (line.StartsWith("remote: "))
|
||||||
|
{
|
||||||
|
_remoteMessage.Add(line.Substring(8));
|
||||||
|
}
|
||||||
_outputHandler?.Invoke(line);
|
_outputHandler?.Invoke(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Action<string> _outputHandler = null;
|
private readonly Action<string> _outputHandler = null;
|
||||||
|
private List<string> _remoteMessage = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue