mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 21:08:15 +08:00
Add support for different spinners
This commit is contained in:

committed by
Patrik Svensson

parent
3c504155bc
commit
cbed41e637
@ -2,6 +2,7 @@
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Generated {{ date.now | date.to_string `%F %R` }}
|
||||
// Generated from https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
@ -0,0 +1,45 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Generated {{ date.now | date.to_string `%F %R` }}
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Spectre.Console
|
||||
{
|
||||
public abstract partial class ProgressSpinner
|
||||
{
|
||||
{{~ for spinner in spinners ~}}
|
||||
private sealed class {{ spinner.normalized_name }}Spinner : ProgressSpinner
|
||||
{
|
||||
public override TimeSpan Interval => TimeSpan.FromMilliseconds({{ spinner.interval }});
|
||||
public override bool IsUnicode => {{ spinner.unicode }};
|
||||
public override IReadOnlyList<string> Frames => new List<string>
|
||||
{
|
||||
{{~ for frame in spinner.frames ~}}
|
||||
"{{ frame }}",
|
||||
{{~ end ~}}
|
||||
};
|
||||
}
|
||||
{{~ end ~}}
|
||||
|
||||
/// <summary>
|
||||
/// Contains all predefined spinners.
|
||||
/// </summary>
|
||||
public static class Known
|
||||
{
|
||||
{{~ for spinner in spinners ~}}
|
||||
/// <summary>
|
||||
/// Gets the "{{ spinner.name }}" spinner.
|
||||
/// </summary>
|
||||
public static ProgressSpinner {{ spinner.normalized_name }} { get; } = new {{ spinner.normalized_name }}Spinner();
|
||||
{{~ end ~}}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user