{"id":15510274,"url":"https://github.com/chelnak/ysmrr","last_synced_at":"2025-04-04T11:14:14.916Z","repository":{"id":45836845,"uuid":"514806230","full_name":"chelnak/ysmrr","owner":"chelnak","description":"YSMRR is a package that provides simple multi-line compatible spinners for Go applications.","archived":false,"fork":false,"pushed_at":"2025-03-06T07:09:00.000Z","size":552,"stargazers_count":83,"open_issues_count":4,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T10:08:31.266Z","etag":null,"topics":["cli","go","golang","hacktoberfest","multi-line-spinner","progress-bar","spinner","statusbar","terminal","terminal-ui"],"latest_commit_sha":null,"homepage":"","language":"Go","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/chelnak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-17T10:00:47.000Z","updated_at":"2025-02-05T22:23:41.000Z","dependencies_parsed_at":"2023-01-31T08:10:12.503Z","dependency_job_id":"6e6c3ef1-232b-4d2e-add5-faf55e76ceac","html_url":"https://github.com/chelnak/ysmrr","commit_stats":{"total_commits":106,"total_committers":5,"mean_commits":21.2,"dds":0.2547169811320755,"last_synced_commit":"639fb56d541b4834b695961ce8ed2250de36947c"},"previous_names":["chelnak/you-spin-me-right-round"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chelnak%2Fysmrr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chelnak%2Fysmrr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chelnak%2Fysmrr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chelnak%2Fysmrr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chelnak","download_url":"https://codeload.github.com/chelnak/ysmrr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"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":["cli","go","golang","hacktoberfest","multi-line-spinner","progress-bar","spinner","statusbar","terminal","terminal-ui"],"created_at":"2024-10-02T09:47:22.868Z","updated_at":"2025-04-04T11:14:14.891Z","avatar_url":"https://github.com/chelnak.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# You spin me right round\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/chelnak/ysmrr.svg)](https://pkg.go.dev/github.com/chelnak/ysmrr) [![Go Version](https://img.shields.io/github/go-mod/go-version/chelnak/ysmrr.svg)](https://github.com/chelnak/ysmrr) [![GoReportCard](https://goreportcard.com/badge/github.com/chelnak/ysmrr)](https://goreportcard.com/report/github.com/chelnak/ysmrr)\n\nYou Spin Me Right Round (`ysmrr`) is a package that provides simple multi-line compatible spinners for Go applications.\n\n![\"ysmrr - examples/advanced/main.go\"](advanced-example.gif)\n\n## Installing\n\n```bash\ngo get -u github.com/chelnak/ysmrr\n```\n\n## Usage\n\n### SpinnerManager\n\nA `SpinnerManager` is a collection of spinners that share a common configuration.\n\nThey can be created as follows:\n\n```go\nsm := ysmrr.NewSpinnerManager()\n```\n\nThe `NewSpinnerManager` method also accepts multiple options. For example, you can change the animation and the color of the spinner:\n\n```go\nsm := ysmrr.NewSpinnerManager(\n    ysmrr.WithAnimation(animations.Pipe),\n    ysmrr.WithSpinnerColor(colors.FgHiBlue),\n)\n```\n\nA `SpinnerManager` is also responsible for starting and stopping a group of spinners.\n\n#### Starting a spinner group\n\n```go\nsm.Start()\n```\n\n#### Stopping a spinner group\n\n```go\nsm.Stop()\n```\n\nRunning `Stop()` on a stopped spinner group is a noop operation.\n\n#### Checking if a spinner group is running\n\n```go\nsm := ysmrr.NewSpinnerManager()\nsm.Start()\nisRunning := sm.Running() // true\nsm.Stop()\nisRunning = sm.Running() // false\n```\n\n### Spinners\n\n`SpinnerManagers` are great but pretty useless on their own. You need to add at least one spinner.\n\nAdding a new spinner is as simple as using the `AddSpinner` method on a `SpinnerManager` instance.\n\nIt expects a string that will be displayed as the initial message of a spinner.\n\n```go\nspinner := sm.AddSpinner(\"Downloading...\")\n```\n\n`AddSpinner` will return a spinner instance that you can use to control the spinner.\n\n#### Updating the message\n\nThoughout the lifecycle of a spinner, you can update the message of the spinner.\n\n```go\nspinner.UpdateMessage(\"Downloading...\")\n```\n\n#### Spinner state\n\nA spinner can be set to either `Complete` or `Error` to indicate the current state of a task.\n\n```go\nspinner.Complete()\n```\n\n```go\nspinner.Error()\n```\n\n### Example\n\nTo tie everything together, here is an example that shows how to build a\nbasic spinner app.\n\n```go\n// Create a new spinner manager\nsm := ysmrr.NewSpinnerManager()\n\n// Add a spinner\nmySpinner := sm.AddSpinner(\"Spinny things...\")\n\n// Start the spinners that have been added to the group\nsm.Start()\n\n// Set the spinner to complete\ntime.Sleep(2 * time.Second)\nmySpinner.Complete()\n\n// Stop the spinners in the group\ntime.Sleep(2 * time.Second)\nsm.Stop()\n```\n\nFor more usage examples, check out the [examples](examples) directory.\n\n## Inspiration\n\nYsmrr was inspired by the following projects:\n\n- [github.com/briandowns/spinner](https://github.com/briandowns/spinner)\n- [github.com/theckman/yacspin](https://github.com/theckman/yacspin)\n\nIt also uses [github.com/fatih/color](https://github.com/fatih/color) for the underlying color system\nand [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable) for Windows support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchelnak%2Fysmrr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchelnak%2Fysmrr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchelnak%2Fysmrr/lists"}