{"id":37167760,"url":"https://github.com/gngtwhh/gocui","last_synced_at":"2026-01-14T19:50:53.531Z","repository":{"id":243976050,"uuid":"813460624","full_name":"gngtwhh/gocui","owner":"gngtwhh","description":"A simple command line graphics template","archived":false,"fork":false,"pushed_at":"2025-08-09T15:40:32.000Z","size":22152,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T17:35:37.809Z","etag":null,"topics":["command-line","go","golang","library","progress-bar"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gngtwhh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-06-11T06:11:28.000Z","updated_at":"2025-08-09T15:40:35.000Z","dependencies_parsed_at":"2024-06-28T11:08:34.250Z","dependency_job_id":"63da8d98-6c0e-478d-a23b-036729614d26","html_url":"https://github.com/gngtwhh/gocui","commit_stats":null,"previous_names":["gngtwhh/gocui"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gngtwhh/gocui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngtwhh%2Fgocui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngtwhh%2Fgocui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngtwhh%2Fgocui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngtwhh%2Fgocui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gngtwhh","download_url":"https://codeload.github.com/gngtwhh/gocui/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngtwhh%2Fgocui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28433250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["command-line","go","golang","library","progress-bar"],"created_at":"2026-01-14T19:50:52.898Z","updated_at":"2026-01-14T19:50:53.519Z","avatar_url":"https://github.com/gngtwhh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gocui\r\n\r\nGocui is a simple command line graphics toolkit for Go.Use it to build simple command line applications easily.\r\n\r\n// At present, this is just a simple small project, welcome to help improve it.\r\n\r\n# Features\r\n- Easy to use. Just create an object and set its style, then call `Run()` to start the application.\r\n- Customizable style. You can choose from different tokens to customize the style of the objects.\r\n- Compatible. It use CSI codes to control the terminal.\r\n\r\n# Functions\r\n- Progress bar: Create a progress bar or an uncertain progress bar. And you can set the style of the progress bar.\r\n- Text box: Create a text box to contain text.\r\n- graph: Draw lines or curves in the terminal.\r\n\r\n# Examples\r\n\r\n## Progress Bar\r\nbar running by iter.\r\n\r\n### Use Default Bar Style\r\ngocui provide a default bar style:\r\n```go\r\np := pb.DefaultBar\r\nit, _ := p.Iter()\r\nfor range it {\r\n\t//fmt.Printf(\"i=%d\\n\", i)\r\n\ttime.Sleep(time.Millisecond * 50) // Simulate some time-consuming task\r\n}\r\n```\r\nwhich looks like:\r\n![Example of default progress bar](examples/progressbar/defaultbar/defaultbar.gif)\r\n\r\n### Common usage\r\nYou can decorate the bar by format string with tokens supported.\r\n\r\n```go\r\n// test progress bar\r\np, _ := pb.NewProgressBar(\"%spinner[%bar] %percent %rate [%elapsed]\",\r\n\tpb.WithStyle(pb.Style{\r\n\t\tComplete:        \"\u003e\",\r\n\t\tIncomplete:      \"-\",\r\n\t\tCompleteColor:   font.Green,\r\n\t\tIncompleteColor: font.LightBlack,\r\n\t}))\r\nit, _ := p.Iter()\r\nfor range it {\r\n\ttime.Sleep(time.Millisecond * 50) // Simulate some time-consuming task\r\n}\r\n```\r\nWhich looks like:\r\n![Example of progress bar](examples/progressbar/common/commonbar.gif)\r\n\r\n### Uncertain progress bar\r\ngocui support uncertain bar, main goroutine can stop it anytime.\r\n\r\n```go\r\n//test uncertain progress bar\r\nup, _ := pb.NewProgressBar(\"[%bar] waiting operation...%spinner\", pb.WithUncertain(),\r\n\tpb.WithStyle(pb.Style{\r\n\t\tIncomplete: \" \",\r\n\t\tUnCertain:  \"👈🤣👉\",\r\n\t}))\r\nstop := up.Run(time.Millisecond * 100)\r\n// Simulate a 3-second time-consuming task\r\ntime.Sleep(time.Second * 3)\r\nclose(stop)\r\nfmt.Printf(\"\\ndone\")\r\n```\r\nwhich looks like:\r\n![Example of uncertain progress bar](examples/progressbar/uncertain/uncertainbar.gif)\r\n\r\n### I/O Progress Bar\r\nData is synchronously written to the progress bar as a progress update.\r\n\r\n```go\r\nreq, _ := http.NewRequest(\"GET\", \"https://studygolang.com/dl/golang/go1.23.5.src.tar.gz\", nil)\r\n\treq.Header.Add(\"Accept-Encoding\", \"identity\")\r\n\tresp, err := http.DefaultClient.Do(req)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\r\n\tf, _ := os.OpenFile(\"go1.23.5.src.tar.gz\", os.O_CREATE|os.O_WRONLY, 0644)\r\n\tdefer func() {\r\n\t\tf.Close()\r\n\t\tif err := os.Remove(\"go1.23.5.src.tar.gz\"); err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t}()\r\n\r\n\tfmt.Println(\"downloading...\")\r\n\tbar, _ := pb.NewProgressBar(\"[%bar] %percent %bytes\", pb.WithWriter(), pb.WithTotal(resp.ContentLength))\r\n\tbarWriter, _ := bar.RunWithWriter()\r\n\tif _, err := io.Copy(io.MultiWriter(f, barWriter), resp.Body); err != nil {\r\n\t\tfmt.Print(err.Error())\r\n\t}\r\n\tfmt.Print(\"\\ndone\")\r\n```\r\nwhich looks like:\r\n![Example of I/O progress bar](examples/progressbar/writingbytes_bar/writingbytes_bar.gif)\r\n\r\n## Text box\r\n```go\r\npayload := []string{\r\n\t\t\"          Books Management System\",\r\n\t\t\"\",\r\n\t\t\" 1.Store new books    2.New user registration\",\r\n\t\t\" 3.Borrow books       4.Return books\",\r\n\t\t\" 5.All books          6.All user\",\r\n\t\t\" 7.Delete database    8.Log out\",\r\n\t\t\"\",\r\n\t\t\"          Select operation number:\",\r\n\t}\r\nwindow.ClearScreen()\r\naBox, _ := box.GetBox(len(payload)+2, 50+2, \"bold\", payload)\r\nbox.SetBoxAt(aBox, 0, 0)\r\n```\r\n\r\nThis will create a text box and set it to the top left corner of the screen.\r\n\r\n# Customization\r\n\r\n// Currently, only Progress bar is supported.\r\n\r\nUse a format string to customize the style of the objects,in which you can use the tokens to customize the style of the objects.\r\n\r\nYou can think of tokens as verbs in go.\r\n\r\n## Tokens\r\n\r\nTokens that users use to customize the style of the objects.\r\n\r\n### progress bar\r\n- `%bar`: the progress bar\r\n- `%current`: the current value\r\n- `%total`: the total value\r\n- `%percent`: the percentage\r\n- `%elapsed`: the elapsed time\r\n- `%rate`: Interval between two updates\r\n\r\n# TODO\r\n- [ ] Add more examples\r\n- [ ] Add more modules\r\n- [ ] Support more tokens\r\n- [ ] Allow users define their own tokens\r\n- [ ] Expand application scenarios, such as support parameters processing...\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgngtwhh%2Fgocui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgngtwhh%2Fgocui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgngtwhh%2Fgocui/lists"}