{"id":13983821,"url":"https://github.com/buger/goterm","last_synced_at":"2025-05-14T02:09:48.632Z","repository":{"id":9344746,"uuid":"11194491","full_name":"buger/goterm","owner":"buger","description":"Advanced terminal output in Go","archived":false,"fork":false,"pushed_at":"2023-02-25T07:52:03.000Z","size":45,"stargazers_count":976,"open_issues_count":12,"forks_count":71,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-10T18:39:32.661Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/buger.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}},"created_at":"2013-07-05T07:56:19.000Z","updated_at":"2025-04-08T22:26:24.000Z","dependencies_parsed_at":"2022-06-26T00:12:36.743Z","dependency_job_id":"38960e79-1b1a-4ce2-801f-cf8680bf2aa0","html_url":"https://github.com/buger/goterm","commit_stats":{"total_commits":43,"total_committers":22,"mean_commits":"1.9545454545454546","dds":0.5581395348837209,"last_synced_commit":"0ebe063d8bfa7f987e2216fa1531485f60c33b71"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buger%2Fgoterm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buger%2Fgoterm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buger%2Fgoterm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buger%2Fgoterm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buger","download_url":"https://codeload.github.com/buger/goterm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254053298,"owners_count":22006717,"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":[],"created_at":"2024-08-09T05:01:56.901Z","updated_at":"2025-05-14T02:09:43.595Z","avatar_url":"https://github.com/buger.png","language":"Go","readme":"## Description\n\nThis library provides basic building blocks for building advanced console UIs.\n\nInitially created for [Gor](http://github.com/buger/gor).\n\nFull API documentation: http://godoc.org/github.com/buger/goterm\n\n## Basic usage\n\nFull screen console app, printing current time:\n\n```go\nimport (\n    tm \"github.com/buger/goterm\"\n    \"time\"\n)\n\nfunc main() {\n    tm.Clear() // Clear current screen\n\n    for {\n        // By moving cursor to top-left position we ensure that console output\n        // will be overwritten each time, instead of adding new.\n        tm.MoveCursor(1,1)\n\n        tm.Println(\"Current Time:\", time.Now().Format(time.RFC1123))\n\n        tm.Flush() // Call it every time at the end of rendering\n\n        time.Sleep(time.Second)\n    }\n}\n```\n\nThis can be seen in [examples/time_example.go](examples/time_example.go).  To\nrun it yourself, go into your `$GOPATH/src/github.com/buger/goterm` directory\nand run `go run ./examples/time_example.go`\n\n\nPrint red bold message on white background:\n\n```go    \ntm.Println(tm.Background(tm.Color(tm.Bold(\"Important header\"), tm.RED), tm.WHITE))\n```\n\n\nCreate box and move it to center of the screen:\n\n```go\ntm.Clear()\n\n// Create Box with 30% width of current screen, and height of 20 lines\nbox := tm.NewBox(30|tm.PCT, 20, 0)\n\n// Add some content to the box\n// Note that you can add ANY content, even tables\nfmt.Fprint(box, \"Some box content\")\n\n// Move Box to approx center of the screen\ntm.Print(tm.MoveTo(box.String(), 40|tm.PCT, 40|tm.PCT))\n\ntm.Flush()\n```\n\nThis can be found in [examples/box_example.go](examples/box_example.go).\n\nDraw table:\n\n```go\n// Based on http://golang.org/pkg/text/tabwriter\ntotals := tm.NewTable(0, 10, 5, ' ', 0)\nfmt.Fprintf(totals, \"Time\\tStarted\\tActive\\tFinished\\n\")\nfmt.Fprintf(totals, \"%s\\t%d\\t%d\\t%d\\n\", \"All\", started, started-finished, finished)\ntm.Println(totals)\ntm.Flush()\n```\n\nThis can be found in [examples/table_example.go](examples/table_example.go).\n\n## Line charts\n\nChart example:\n\n![screen shot 2013-07-09 at 5 05 37 pm](https://f.cloud.github.com/assets/14009/767676/e3dd35aa-e887-11e2-9cd2-f6451eb26adc.png)\n\n\n```go\n    import (\n        tm \"github.com/buger/goterm\"\n    )\n\n    chart := tm.NewLineChart(100, 20)\n    \n    data := new(tm.DataTable)\n    data.AddColumn(\"Time\")\n    data.AddColumn(\"Sin(x)\")\n    data.AddColumn(\"Cos(x+1)\")\n\n    for i := 0.1; i \u003c 10; i += 0.1 {\n\tdata.AddRow(i, math.Sin(i), math.Cos(i+1))\n    }\n    \n    tm.Println(chart.Draw(data))\n```\n\nThis can be found in [examples/chart_example.go](examples/chart_example.go).\n\nDrawing 2 separate graphs in different scales. Each graph have its own Y axe.\n\n```go\nchart.Flags = tm.DRAW_INDEPENDENT\n```\n\nDrawing graph with relative scale (Grapwh draw starting from min value instead of zero)\n\n```go\nchart.Flags = tm.DRAW_RELATIVE\n```\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuger%2Fgoterm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuger%2Fgoterm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuger%2Fgoterm/lists"}