{"id":21571102,"url":"https://github.com/treblle/treblle","last_synced_at":"2025-08-25T19:09:27.751Z","repository":{"id":191017610,"uuid":"683772842","full_name":"Treblle/treblle","owner":"Treblle","description":"A framework enabling Go developers to easily create CLI applications.","archived":false,"fork":false,"pushed_at":"2024-03-13T14:15:50.000Z","size":19,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T14:45:40.052Z","etag":null,"topics":["application","c","cli","cli-app","framework","go","golang","golang-application"],"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/Treblle.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}},"created_at":"2023-08-27T16:48:35.000Z","updated_at":"2023-10-28T07:04:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"dbc667e4-e08a-4e10-82d1-0dd5a3c99830","html_url":"https://github.com/Treblle/treblle","commit_stats":null,"previous_names":["treblle/treblle"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Treblle/treblle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Treblle","download_url":"https://codeload.github.com/Treblle/treblle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272117349,"owners_count":24876385,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["application","c","cli","cli-app","framework","go","golang","golang-application"],"created_at":"2024-11-24T11:14:53.342Z","updated_at":"2025-08-25T19:09:27.710Z","avatar_url":"https://github.com/Treblle.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://treblle-github.s3.us-east-1.amazonaws.com/github-header.jpg\"/\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n# Treblle CLI\n\n\u003ca href=\"https://docs.treblle.com/en/integrations\" target=\"_blank\"\u003eIntegrations\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"http://treblle.com/\" target=\"_blank\"\u003eWebsite\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://docs.treblle.com\" target=\"_blank\"\u003eDocs\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://blog.treblle.com\" target=\"_blank\"\u003eBlog\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://twitter.com/treblleapi\" target=\"_blank\"\u003eTwitter\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://treblle.com/chat\" target=\"_blank\"\u003eDiscord\u003c/a\u003e\n\u003cbr /\u003e\n\n  \u003chr /\u003e\n\u003c/div\u003e\n\nA framework for building CLI applications fluently in Go.\n\n\u003e This is currently unreleased, and is a work in progress. Breaking Changes are expected.\n\n## Usage\n\nTo start you need to create your `main.go` and create a new application\n\n```go\n\nconst (\n\tAppDir = \"/.your-app\"\n)\n\nfunc main() {\n    app := app.New(\n        \"CLI Name\", // The Name of your CLI Application\n        AppDir, // The path within ~/.config to create CLI configuration\n        1000, // The number of parallel workers you want to be available for dispatching tasks\n    )\n\n    app.Boot() // This will boot the application, setting the storage path for this run.\n\n    // If you need to load your CLI config from a file you can do that using a fluent interface\n    app.Config.LoadFromFile(app.Storage.Path + \"/config.go\")\n}\n```\n\nOnce you have a basic application set up, you can move onto registering your commands using the fluent builder interface\n\n```go\nfunc main() {\n    ... other code goes here\n\n    RegisterCommands(app) // Register all the commands in your application\n\n    app.Console.RootCmd.Execute() // Execute your main command\n}\n\nfunc RegisterCommands(app *app.App) {\n    app.Console.Register(\n\t\tconsole.\n\t\t\tBuild(\"test\"). // The name of the command\n\t\t\tDescription(\"Test command\"). // the description (short) for the command\n\t\t\tAction(func(cmd *cobra.Command, args []string) {\n\t\t\t\tlog.Info(\"Test Command Called\") // what you want this command to do\n\t\t\t}\n        ),\n\t)\n}\n```\n\n## Using the HTTP Client\n\n```go\nfunc main() {\n    ... other code goes here\n\n    request := app.Http.Base(\"https://api.treblle.com/\").WithToken(\"123123\")\n\n\tvar message Message\n\n\tresponse, err := request.Get(\"/\")\n\tif err != nil {\n\t\tlog.Errorf(\"Request error: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tlog.Infof(\"Success: %v\", response.JSON(\u0026message))\n}\n```\n\n## Using the Applications Queue\n\nYou can start your applications queue runner, which will listen on a wait group for Jobs to be passed into it\n\n```go\nfunc main() {\n    ... other code goes here\n\n    runner := app.Queue\n\n\trunner.Run()\n}\n\nfunc SomeOtherMethod() {\n    var wg sync.WaitGroup\n\tfor i := 0; i \u003c 100; i++ {\n\t\twg.Add(1)\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tjob := \u0026ExampleJob{Message: fmt.Sprintf(\"Hello, I am job number %d\", i)}\n\t\t\tdispatcher.JobQueue \u003c- job\n\t\t}(i)\n\t}\n\twg.Wait()\n}\n```\n\n## Using the Event Dispatcher\n\n```go\nfunc main() {\n    ... other code goes here\n\n    // Register listeners\n\tapp.Dispatcher.Event(\"UserRegistered\").\n\t\tListen(func(data event.EventData) {\n\t\t\tuserData, _ := data.(map[string]string)\n\t\t\tprintln(\"Send welcome email to:\", userData[\"email\"])\n\t\t}).\n\t\tListen(func(data event.EventData) {\n\t\t\tprintln(\"Log user registration to audit trail.\")\n\t\t})\n}\n\nfunc SomeOtherMethod() {\n    // Dispatch event\n\tapp.Dispatcher.Event(\"UserRegistered\").Dispatch(map[string]string{\n\t\t\"email\": \"user@example.com\",\n\t\t\"name\":  \"John Doe\",\n\t})\n}\n```\n\n## Examples\n\n- [Simple Example](./examples/simple.go)\n\n\n## Community 💙\n\nFirst and foremost: **Star and watch this repository** to stay up-to-date.\n\nAlso, follow our [Blog](https://blog.treblle.com), and on [Twitter](https://twitter.com/treblleapi).\n\nYou can chat with the team and other members on [Discord](https://treblle.com/chat) and follow our tutorials and other video material at [YouTube](https://youtube.com/@treblle).\n\n[![Treblle Discord](https://img.shields.io/badge/Treblle%20Discord-Join%20our%20Discord-F3F5FC?labelColor=7289DA\u0026style=for-the-badge\u0026logo=discord\u0026logoColor=F3F5FC\u0026link=https://treblle.com/chat)](https://treblle.com/chat)\n\n[![Treblle YouTube](https://img.shields.io/badge/Treblle%20YouTube-Subscribe%20on%20YouTube-F3F5FC?labelColor=c4302b\u0026style=for-the-badge\u0026logo=YouTube\u0026logoColor=F3F5FC\u0026link=https://youtube.com/@treblle)](https://youtube.com/@treblle)\n\n[![Treblle on Twitter](https://img.shields.io/badge/Treblle%20on%20Twitter-Follow%20Us-F3F5FC?labelColor=1DA1F2\u0026style=for-the-badge\u0026logo=Twitter\u0026logoColor=F3F5FC\u0026link=https://twitter.com/treblleapi)](https://twitter.com/treblleapi)\n\n### How to contribute\n\nHere are some ways of contributing to making Treblle better:\n\n- **[Try out Treblle](https://docs.treblle.com/en/introduction#getting-started)**, and let us know ways to make Treblle better for you. Let us know here on [Discord](https://treblle.com/chat).\n- Join our [Discord](https://treblle.com/chat) and connect with other members to share and learn from.\n- Send a pull request to any of our [open source repositories](https://github.com/Treblle) on Github. Check the contribution guide on the repo you want to contribute to for more details about how to contribute. We're looking forward to your contribution!\n\n### Contributors\n\u003ca href=\"https://github.com/Treblle/treblle/graphs/contributors\"\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimg  src=\"https://contrib.rocks/image?repo=Treblle/treblle\" alt=\"A table of avatars from the project's contributors\" /\u003e\n  \u003c/p\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreblle%2Ftreblle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle/lists"}