mirror of
https://github.com/nsnail/dot.git
synced 2025-06-18 21:38:15 +08:00
<refactor> ui美化...
This commit is contained in:
35
src/Git/TaskStatusColumn.cs
Normal file
35
src/Git/TaskStatusColumn.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.ComponentModel;
|
||||
using NSExt.Extensions;
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace Dot.Git;
|
||||
|
||||
public class TaskStatusColumn : ProgressColumn
|
||||
{
|
||||
public enum Statues : byte
|
||||
{
|
||||
[Description($"[gray]{nameof(Ready)}[/]")]
|
||||
Ready
|
||||
|
||||
, [Description($"[yellow]{nameof(Executing)}[/]")]
|
||||
Executing
|
||||
|
||||
, [Description($"[green]{nameof(Succeed)}[/]")]
|
||||
Succeed
|
||||
|
||||
, [Description($"[red]{nameof(Failed)}[/]")]
|
||||
Failed
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the task description.
|
||||
/// </summary>
|
||||
public Justify Alignment { get; set; } = Justify.Right;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
|
||||
{
|
||||
var text = task.State.Get<Statues>(nameof(TaskStatusColumn));
|
||||
return new Markup(text.Desc()).Overflow(Overflow.Ellipsis).Justify(Alignment);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user