From ec89adc57b0e8aac380e789888c6b95e22cf2634 Mon Sep 17 00:00:00 2001 From: Mayuki Sawatari Date: Fri, 30 Jul 2021 15:43:31 +0900 Subject: [PATCH 1/3] fix: If a text contains non-ASCII chars, some chars remain in a line. --- Kurukuru/ConsoleHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kurukuru/ConsoleHelper.cs b/Kurukuru/ConsoleHelper.cs index 6b8cab3..2069185 100644 --- a/Kurukuru/ConsoleHelper.cs +++ b/Kurukuru/ConsoleHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Kurukuru { @@ -36,7 +36,7 @@ public static void ClearCurrentConsoleLine(int length) int currentLineCursor = Console.CursorTop; Console.SetCursorPosition(0, Console.CursorTop); - Console.Write(new string(' ', length)); + Console.Write(new string(' ', Console.WindowWidth)); Console.SetCursorPosition(0, currentLineCursor); Console.Out.Flush(); } From 21b47cae046f7d7341bc3950099bf7e2d1c128f2 Mon Sep 17 00:00:00 2001 From: Mayuki Sawatari Date: Fri, 30 Jul 2021 15:49:13 +0900 Subject: [PATCH 2/3] chore: Add sample project --- Kurukuru.Sample/Kurukuru.Sample.csproj | 12 +++++++++ Kurukuru.Sample/Program.cs | 34 ++++++++++++++++++++++++++ Kurukuru.sln | 6 +++++ 3 files changed, 52 insertions(+) create mode 100644 Kurukuru.Sample/Kurukuru.Sample.csproj create mode 100644 Kurukuru.Sample/Program.cs diff --git a/Kurukuru.Sample/Kurukuru.Sample.csproj b/Kurukuru.Sample/Kurukuru.Sample.csproj new file mode 100644 index 0000000..51db7c9 --- /dev/null +++ b/Kurukuru.Sample/Kurukuru.Sample.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + diff --git a/Kurukuru.Sample/Program.cs b/Kurukuru.Sample/Program.cs new file mode 100644 index 0000000..e29b3b9 --- /dev/null +++ b/Kurukuru.Sample/Program.cs @@ -0,0 +1,34 @@ +using System; +using System.Threading.Tasks; + +namespace Kurukuru.Sample +{ + class Program + { + static async Task Main(string[] args) + { + System.Console.OutputEncoding = System.Text.Encoding.UTF8; + + using (var spinner = new Spinner("Initializing...", Patterns.Dots12)) + { + spinner.Start(); + await Task.Delay(2000); + spinner.Succeed(); + } + + await Spinner.StartAsync("ユーザー Alice でログインを試みています…", async spinner => + { + await Task.Delay(1000); + spinner.Text = "こんにちは Alice!"; + }); + + + await Spinner.StartAsync("Executing some heavy task...", async () => + { + await Task.Delay(3000); + throw new Exception(); + }); + + } + } +} diff --git a/Kurukuru.sln b/Kurukuru.sln index ba0dd91..bebebf4 100644 --- a/Kurukuru.sln +++ b/Kurukuru.sln @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Ac .github\workflows\release.yml = .github\workflows\release.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurukuru.Sample", "Kurukuru.Sample\Kurukuru.Sample.csproj", "{6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,6 +28,10 @@ Global {43150AB2-3041-4EC2-B17D-B8F6D3913561}.Debug|Any CPU.Build.0 = Debug|Any CPU {43150AB2-3041-4EC2-B17D-B8F6D3913561}.Release|Any CPU.ActiveCfg = Release|Any CPU {43150AB2-3041-4EC2-B17D-B8F6D3913561}.Release|Any CPU.Build.0 = Release|Any CPU + {6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From a1ab5b4b3b1ae1c02a7a53df58c040fd0d93972b Mon Sep 17 00:00:00 2001 From: Mayuki Sawatari Date: Fri, 30 Jul 2021 15:51:49 +0900 Subject: [PATCH 3/3] build: Use .NET 5 SDK --- .github/workflows/build.yaml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7af70aa..ce999d8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.x' + dotnet-version: '5.0.x' # Build - run: dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de41ec8..d89b9b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.x' + dotnet-version: '5.0.x' - name: "dotnet build & pack" run: |