{"id":19099925,"url":"https://github.com/mayuki/Kurukuru","last_synced_at":"2025-04-18T17:32:18.539Z","repository":{"id":44986900,"uuid":"112836981","full_name":"mayuki/Kurukuru","owner":"mayuki","description":"Terminal Spinner for .NET platform","archived":false,"fork":false,"pushed_at":"2022-01-15T02:21:12.000Z","size":171,"stargazers_count":657,"open_issues_count":3,"forks_count":19,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-11T09:55:03.196Z","etag":null,"topics":["c-sharp","cli","command-line","dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mayuki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-02T11:33:22.000Z","updated_at":"2024-10-05T14:28:17.000Z","dependencies_parsed_at":"2022-09-24T21:40:36.160Z","dependency_job_id":null,"html_url":"https://github.com/mayuki/Kurukuru","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FKurukuru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FKurukuru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FKurukuru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FKurukuru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mayuki","download_url":"https://codeload.github.com/mayuki/Kurukuru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783108,"owners_count":17201903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","cli","command-line","dotnet"],"created_at":"2024-11-09T03:52:23.242Z","updated_at":"2024-11-09T03:52:44.134Z","avatar_url":"https://github.com/mayuki.png","language":"C#","funding_links":[],"categories":["cli","dotnet","🗒️ Cheatsheets"],"sub_categories":["📦 Libraries"],"readme":"# Kurukuru\n[![Build-Development](https://github.com/mayuki/Kurukuru/workflows/Build-Development/badge.svg)](https://github.com/mayuki/Kurukuru/actions)\n\n\u003e Terminal Spinner library for .NET platform (.NET Framework, .NET Standard, .NET 5). strongly inspired by [cli-spinners](https://github.com/sindresorhus/cli-spinners), [ora](https://github.com/sindresorhus/ora), [CLISpinner](https://github.com/kiliankoe/CLISpinner).\n\n![](Resources/Screen-Demo-01.gif)\n\n## Features\n### Aware non-Unicode codepage on Windows environment.\nWhen running on terminal using non-Unicode codepages (e.g. CP437:EN-US, CP932:JA-JP), the library will render using ASCII-characters spinner by default.\n\n- fig. Left:Command Prompt (CP932) / Right:mintty (UTF-8 on Linux)\u003cbr /\u003e![](Resources/Screen-Demo-02.gif) \n\n**NOTE:** Sadly, today's almost Windows are configured as using non-Unicode (UTF-8) code page and \"Command Prompt\" doesn't support font fallback yet.☹ If you want to see non-ASCII spinners, you can change the code page either by `System.Console.OutputEncoding = System.Text.Encoding.UTF8` or by running\n `chcp 65001` command and then use [ConEmu](https://conemu.github.io/) or [mintty](https://mintty.github.io/) to display the fallback font. \n\n- See: [Screenshot: cmd vs ConEmu on Windows 10(EN-US)](Resources/CmdAndConEmu.png)\n\n### Disable spinner automatically when running on a non-interactive context in which stdout is redirected.\n\nFor example, you can see just a result text when runs on CI.\n\n## Install\n\n### Package Manager Console\n```\nInstall-Package Kurukuru\n```\n\n### **dotnet** command\n```\ndotnet add package Kurukuru\n```\n\n\n## Usage\nJust add `using Kurukuru;` then call `Spinner.Start` with some delegate. \n\n```csharp\nSpinner.Start(\"Processing...\", () =\u003e\n{\n    Thread.Sleep(1000 * 3);\n    \n    // MEMO: If you want to show as failed, throw a exception here.\n    // throw new Exception(\"Something went wrong!\");\n});\n\nSpinner.Start(\"Stage 1...\", spinner =\u003e\n{\n    Thread.Sleep(1000 * 3);\n    spinner.Text = \"Stage 2...\";\n    Thread.Sleep(1000 * 3);\n    spinner.Fail(\"Something went wrong!\");\n});\n```\n\nYou can also use async method pattern. Use `StartAsync` method.\n\n```csharp\nawait Spinner.StartAsync(\"Processing...\", async () =\u003e\n{\n    await Task.Delay(1000 * 3);\n    \n    // MEMO: If you want to show as failed, throw a exception here.\n    // throw new Exception(\"Something went wrong!\");\n});\n\nawait Spinner.StartAsync(\"Stage 1...\", async spinner =\u003e\n{\n    await Task.Delay(1000 * 3);\n    spinner.Text = \"Stage 2...\";\n    await Task.Delay(1000 * 3);\n    spinner.Fail(\"Something went wrong!\");\n});\n```\n\n## API\n### `Kurukuru.Spinner` class\n#### Static Members\n- `Start` / `StartAsync`: Create and start new spinner. And it waits specified action.\n    - `void Start(string text, Action\u003cSpinner\u003e action, Pattern pattern = null, Pattern fallbackPattern = null)`\n    - `void Start(string text, Action\u003cSpinner\u003e action, Pattern pattern = null, Pattern fallbackPattern = null)`\n    - `Task StartAsync(string text, Func\u003cTask\u003e action, Pattern pattern = null, Pattern fallbackPattern = null)`\n    - `Task StartAsync(string text, Func\u003cSpinner, Task\u003e action, Pattern pattern = null, Pattern fallbackPattern = null)`\n        - `text`: a text to display while running action.\n        - `action`: a long-running action.\n        - `patterns`: Use spinner pattern (see `Patterns` class). Default value is `Patterns.Dot`. You can find a pattern you like in [the preview of cli-spinners](http://jsfiddle.net/sindresorhus/2eLtsbey/embedded/result/).\n        - `fallbackPattern`: Use spinner pattern if console's codepage is non-Unicode. Default value is `Patterns.Line`.\n\n#### Instance Methods\n- `Stop`: Stop spinner and show a result if needed.\n    - `Stop(string text = null, string symbol = null, ConsoleColor? color = null)`\n    - `Stop(string text, string symbol, ConsoleColor? color, string terminator)`\n- `Success`: Show result as ✔ success. (equivalent to `Stop` method)\n- `Fail`: Show result as ✖ failure. (equivalent to `Stop` method)\n- `Warning`: Show result as ⚠ warning. (equivalent to `Stop` method)\n- `Info`: Show result as ℹ information. (equivalent to `Stop` method)\n\n#### Instance Properties\n- `Text`: Get or set a text to display while running action.\n- `Color`: Get or set a color of the spinner. (not for text)\n\n## Related\n\n- [cli-spinners](https://github.com/sindresorhus/cli-spinners): Spinners for use in the terminal (node.js)\n- [ora](https://github.com/sindresorhus/ora): Elegant terminal spinner (node.js)\n- [CLISpinner](https://github.com/kiliankoe/CLISpinner): Swifty Terminal Spinner\n\n## License\n\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayuki%2FKurukuru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmayuki%2FKurukuru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayuki%2FKurukuru/lists"}