{"id":13410088,"url":"https://github.com/briandowns/spinner","last_synced_at":"2025-05-14T08:05:00.599Z","repository":{"id":24537530,"uuid":"27943989","full_name":"briandowns/spinner","owner":"briandowns","description":"Go (golang) package with 90 configurable terminal spinner/progress indicators.","archived":false,"fork":false,"pushed_at":"2025-01-20T04:30:31.000Z","size":3496,"stargazers_count":2422,"open_issues_count":17,"forks_count":129,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-14T08:02:32.080Z","etag":null,"topics":["cli","go","golang","indicator","progress-bar","progressbar","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":"vaidik/marg","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briandowns.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-13T00:36:19.000Z","updated_at":"2025-05-13T19:44:22.000Z","dependencies_parsed_at":"2025-02-11T08:49:58.400Z","dependency_job_id":null,"html_url":"https://github.com/briandowns/spinner","commit_stats":{"total_commits":260,"total_committers":56,"mean_commits":4.642857142857143,"dds":"0.38076923076923075","last_synced_commit":"f660c0ed742b07aac5b1af1ed8ddb0f5d1ba5bb9"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fspinner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fspinner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fspinner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fspinner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briandowns","download_url":"https://codeload.github.com/briandowns/spinner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101586,"owners_count":22014907,"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","indicator","progress-bar","progressbar","spinner","statusbar","terminal","terminal-ui"],"created_at":"2024-07-30T20:01:04.909Z","updated_at":"2025-05-14T08:05:00.577Z","avatar_url":"https://github.com/briandowns.png","language":"Go","funding_links":[],"categories":["命令行","Misc","开源类库","Go","Repositories","Command Line","Go Libraries","Open source library","Utilities","Tools","實用工具","语言资源库","实用工具","Build Automation","工具库","工具库`可以提升效率的通用代码库和工具`"],"sub_categories":["高级控制台用户界面","命令行","Advanced Console UIs","Atom Extensions","Command Line","高級控制台界面","HTTP Clients","go","查询语","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","高级控制台界面"],"readme":"# Spinner\n\n[![GoDoc](https://godoc.org/github.com/briandowns/spinner?status.svg)](https://godoc.org/github.com/briandowns/spinner) [![CircleCI](https://circleci.com/gh/briandowns/spinner.svg?style=svg)](https://circleci.com/gh/briandowns/spinner)\n\nspinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full examples in the examples directory.\n\nFor more detail about the library and its features, reference your local godoc once installed.\n\nContributions welcome!\n\n## Installation\n\n```bash\ngo get github.com/briandowns/spinner\n```\n\n## Available Character Sets\n\n90 Character Sets. Some examples below:\n\n(Numbered by their slice index)\n\n| index | character set                                                                                                                                                                                                                                                                             | sample gif                 |\n| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |\n| 0     | ```←↖↑↗→↘↓↙```                                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/0.gif)  |\n| 1     | ```▁▃▄▅▆▇█▇▆▅▄▃▁```                                                                                                                                                                                                                                                                       | ![Sample Gif](gifs/1.gif)  |\n| 2     | ```▖▘▝▗```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/2.gif)  |\n| 3     | ```┤┘┴└├┌┬┐```                                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/3.gif)  |\n| 4     | ```◢◣◤◥```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/4.gif)  |\n| 5     | ```◰◳◲◱```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/5.gif)  |\n| 6     | ```◴◷◶◵```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/6.gif)  |\n| 7     | ```◐◓◑◒```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/7.gif)  |\n| 8     | ```.oO@*```                                                                                                                                                                                                                                                                               | ![Sample Gif](gifs/8.gif)  |\n| 9     | ```\\|/-\\```                                                                                                                                                                                                                                                                               | ![Sample Gif](gifs/9.gif)  |\n| 10    | ```◡◡⊙⊙◠◠```                                                                                                                                                                                                                                                                              | ![Sample Gif](gifs/10.gif) |\n| 11    | ```⣾⣽⣻⢿⡿⣟⣯⣷```                                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/11.gif) |\n| 12    | ```\u003e))'\u003e \u003e))'\u003e  \u003e))'\u003e   \u003e))'\u003e    \u003e))'\u003e   \u003c'((\u003c  \u003c'((\u003c \u003c'((\u003c```                                                                                                                                                                                                                            | ![Sample Gif](gifs/12.gif) |\n| 13    | ```⠁⠂⠄⡀⢀⠠⠐⠈```                                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/13.gif) |\n| 14    | ```⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏```                                                                                                                                                                                                                                                                          | ![Sample Gif](gifs/14.gif) |\n| 15    | ```abcdefghijklmnopqrstuvwxyz```                                                                                                                                                                                                                                                          | ![Sample Gif](gifs/15.gif) |\n| 16    | ```▉▊▋▌▍▎▏▎▍▌▋▊▉```                                                                                                                                                                                                                                                                       | ![Sample Gif](gifs/16.gif) |\n| 17    | ```■□▪▫```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/17.gif) |\n| 18    | ```←↑→↓```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/18.gif) |\n| 19    | ```╫╪```                                                                                                                                                                                                                                                                                  | ![Sample Gif](gifs/19.gif) |\n| 20    | ```⇐⇖⇑⇗⇒⇘⇓⇙```                                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/20.gif) |\n| 21    | ```⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈```                                                                                                                                                                                                                                                       | ![Sample Gif](gifs/21.gif) |\n| 22    | ```⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈```                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/22.gif) |\n| 23    | ```⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁```                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/23.gif) |\n| 24    | ```⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋```                                                                                                                                                                                                                                                                   | ![Sample Gif](gifs/24.gif) |\n| 25    | ```ｦｧｨｩｪｫｬｭｮｯｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜﾝ```                                                                                                                                                                                                                             | ![Sample Gif](gifs/25.gif) |\n| 26    | ```. .. ...```                                                                                                                                                                                                                                                                            | ![Sample Gif](gifs/26.gif) |\n| 27    | ```▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁```                                                                                                                                                                                                                                                      | ![Sample Gif](gifs/27.gif) |\n| 28    | ```.oO°Oo.```                                                                                                                                                                                                                                                                             | ![Sample Gif](gifs/28.gif) |\n| 29    | ```+x```                                                                                                                                                                                                                                                                                  | ![Sample Gif](gifs/29.gif) |\n| 30    | ```v\u003c^\u003e```                                                                                                                                                                                                                                                                                | ![Sample Gif](gifs/30.gif) |\n| 31    | ```\u003e\u003e---\u003e \u003e\u003e---\u003e  \u003e\u003e---\u003e   \u003e\u003e---\u003e    \u003e\u003e---\u003e    \u003c---\u003c\u003c    \u003c---\u003c\u003c   \u003c---\u003c\u003c  \u003c---\u003c\u003c \u003c---\u003c\u003c```                                                                                                                                                                                                | ![Sample Gif](gifs/31.gif) |\n| 32    | ```\\| \\|\\| \\|\\|\\| \\|\\|\\|\\| \\|\\|\\|\\|\\| \\|\\|\\|\\|\\|\\| \\|\\|\\|\\|\\| \\|\\|\\|\\| \\|\\|\\| \\|\\| \\|```                                                                                                                                                                                                  | ![Sample Gif](gifs/32.gif) |\n| 33    | ```[] [=] [==] [===] [====] [=====] [======] [=======] [========] [=========] [==========]```                                                                                                                                                                                             | ![Sample Gif](gifs/33.gif) |\n| 34    | ```(*---------) (-*--------) (--*-------) (---*------) (----*-----) (-----*----) (------*---) (-------*--) (--------*-) (---------*)```                                                                                                                                                   | ![Sample Gif](gifs/34.gif) |\n| 35    | ```█▒▒▒▒▒▒▒▒▒ ███▒▒▒▒▒▒▒ █████▒▒▒▒▒ ███████▒▒▒ ██████████```                                                                                                                                                                                                                              | ![Sample Gif](gifs/35.gif) |\n| 36    | ```[                    ] [=\u003e                  ] [===\u003e                ] [=====\u003e              ] [======\u003e             ] [========\u003e           ] [==========\u003e         ] [============\u003e       ] [==============\u003e     ] [================\u003e   ] [==================\u003e ] [===================\u003e]``` | ![Sample Gif](gifs/36.gif) |\n| 37    | ```🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 🕛```                                                                                                                                                                                                                                                             | ![Sample Gif](gifs/37.gif) |\n| 38    | ```🕐 🕜 🕑 🕝 🕒 🕞 🕓 🕟 🕔 🕠 🕕 🕡 🕖 🕢 🕗 🕣 🕘 🕤 🕙 🕥 🕚 🕦 🕛 🕧```                                                                                                                                                                                                                                     | ![Sample Gif](gifs/38.gif) |\n| 39    | ```🌍 🌎 🌏```                                                                                                                                                                                                                                                                               | ![Sample Gif](gifs/39.gif) |\n| 40    | ```◜ ◝ ◞ ◟```                                                                                                                                                                                                                                                                             | ![Sample Gif](gifs/40.gif) |\n| 41    | ```⬒ ⬔ ⬓ ⬕```                                                                                                                                                                                                                                                                             | ![Sample Gif](gifs/41.gif) |\n| 42    | ```⬖ ⬘ ⬗ ⬙```                                                                                                                                                                                                                                                                             | ![Sample Gif](gifs/42.gif) |\n| 43    | ```[\u003e\u003e\u003e          \u003e] []\u003e\u003e\u003e\u003e        [] []  \u003e\u003e\u003e\u003e      [] []    \u003e\u003e\u003e\u003e    [] []      \u003e\u003e\u003e\u003e  [] []        \u003e\u003e\u003e\u003e[] [\u003e\u003e          \u003e\u003e]```                                                                                                                                                              | ![Sample Gif](gifs/43.gif) |\n\n## Features\n\n* Start\n* Stop\n* Restart\n* Reverse direction\n* Update the spinner character set\n* Update the spinner speed\n* Prefix or append text\n* Change spinner color, background, and text attributes such as bold / italics\n* Get spinner status\n* Chain, pipe, redirect output\n* Output final string on spinner/indicator completion\n\n## Examples\n\n```Go\npackage main\n\nimport (\n\t\"github.com/briandowns/spinner\"\n\t\"time\"\n)\n\nfunc main() {\n\ts := spinner.New(spinner.CharSets[9], 100*time.Millisecond)  // Build our new spinner\n\ts.Start()                                                    // Start the spinner\n\ttime.Sleep(4 * time.Second)                                  // Run for some time to simulate work\n\ts.Stop()\n}\n```\n\n## Update the character set and restart the spinner\n\n```Go\ns.UpdateCharSet(spinner.CharSets[1])  // Update spinner to use a different character set\ns.Restart()                           // Restart the spinner\ntime.Sleep(4 * time.Second)\ns.Stop()\n```\n\n## Update spin speed and restart the spinner\n\n```Go\ns.UpdateSpeed(200 * time.Millisecond) // Update the speed the spinner spins at\ns.Restart()\ntime.Sleep(4 * time.Second)\ns.Stop()\n```\n\n## Reverse the direction of the spinner\n\n```Go\ns.Reverse() // Reverse the direction the spinner is spinning\ns.Restart()\ntime.Sleep(4 * time.Second)\ns.Stop()\n```\n\n## Provide your own spinner\n\n(or send me an issue or pull request to add to the project)\n\n```Go\nsomeSet := []string{\"+\", \"-\"}\ns := spinner.New(someSet, 100*time.Millisecond)\n```\n\n## Prefix or append text to the spinner\n\n```Go\ns.Prefix = \"prefixed text: \" // Prefix text before the spinner\ns.Suffix = \"  :appended text\" // Append text after the spinner\n```\n\n## Set or change the color of the spinner.  Default color is white. The spinner will need to be restarted to pick up the change.\n\n```Go\ns.Color(\"red\") // Set the spinner color to red\n```\n\nYou can specify both the background and foreground color, as well as additional attributes such as `bold` or `underline`.\n\n```Go\ns.Color(\"red\", \"bold\") // Set the spinner color to a bold red\n```\n\nTo set the background to black, the foreground to a bold red:\n\n```Go\ns.Color(\"bgBlack\", \"bold\", \"fgRed\")\n```\n\nBelow is the full color and attribute list:\n\n```Go\n// default colors\nred\nblack\ngreen\nyellow\nblue\nmagenta\ncyan\nwhite\n\n// attributes\nreset\nbold\nfaint\nitalic\nunderline\nblinkslow\nblinkrapid\nreversevideo\nconcealed\ncrossedout\n\n// foreground text\nfgBlack\nfgRed\nfgGreen\nfgYellow\nfgBlue\nfgMagenta\nfgCyan\nfgWhite\n\n// foreground Hi-Intensity text\nfgHiBlack\nfgHiRed\nfgHiGreen\nfgHiYellow\nfgHiBlue\nfgHiMagenta\nfgHiCyan\nfgHiWhite\n\n// background text\nbgBlack\nbgRed\nbgGreen\nbgYellow\nbgBlue\nbgMagenta\nbgCyan\nbgWhite\n\n// background Hi-Intensity text\nbgHiBlack\nbgHiRed\nbgHiGreen\nbgHiYellow\nbgHiBlue\nbgHiMagenta\nbgHiCyan\nbgHiWhite\n```\n\n## Generate a sequence of numbers\n\n```Go\nsetOfDigits := spinner.GenerateNumberSequence(25)    // Generate a 25 digit string of numbers\ns := spinner.New(setOfDigits, 100*time.Millisecond)\n```\n\n## Get spinner status\n\n```Go\nfmt.Println(s.Active())\n```\n\n## Unix pipe and redirect\n\nFeature suggested and write up by [dekz](https://github.com/dekz)\n\nSetting the Spinner Writer to Stderr helps show progress to the user, with the enhancement to chain, pipe or redirect the output. \n\nThis is the preferred method of setting a Writer at this time.\n\n```go\ns := spinner.New(spinner.CharSets[11], 100*time.Millisecond, spinner.WithWriter(os.Stderr))\ns.Suffix = \" Encrypting data...\"\ns.Start()\n// Encrypt the data into ciphertext\nfmt.Println(os.Stdout, ciphertext)\n```\n\n```sh\n\u003e myprog encrypt \"Secret text\" \u003e encrypted.txt\n⣯ Encrypting data...\n```\n\n```sh\n\u003e cat encrypted.txt\n1243hjkbas23i9ah27sj39jghv237n2oa93hg83\n```\n\n## Final String Output\n\nAdd additional output when the spinner/indicator has completed. The \"final\" output string can be multi-lined and will be written to wherever the `io.Writer` has been configured for.\n\n```Go\ns := spinner.New(spinner.CharSets[9], 100*time.Millisecond)\ns.FinalMSG = \"Complete!\\nNew line!\\nAnother one!\\n\"\ns.Start()                 \ntime.Sleep(4 * time.Second)\ns.Stop()                   \n```\n\nOutput\n```sh\nComplete!\nNew line!\nAnother one!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriandowns%2Fspinner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriandowns%2Fspinner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriandowns%2Fspinner/lists"}