{"id":27775762,"url":"https://github.com/mihai-valentin/cling","last_synced_at":"2026-02-24T03:31:12.858Z","repository":{"id":290165594,"uuid":"973569051","full_name":"mihai-valentin/cling","owner":"mihai-valentin","description":"A tiny CLI framework","archived":false,"fork":false,"pushed_at":"2025-04-27T09:32:29.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T20:37:37.693Z","etag":null,"topics":["cli","framework","go","minimalistic"],"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/mihai-valentin.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,"zenodo":null}},"created_at":"2025-04-27T09:15:57.000Z","updated_at":"2025-04-27T09:32:33.000Z","dependencies_parsed_at":"2025-04-27T10:32:42.186Z","dependency_job_id":"cbd0b32f-a7b2-4d5b-9b54-588ec8897e1b","html_url":"https://github.com/mihai-valentin/cling","commit_stats":null,"previous_names":["mihai-valentin/cling"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mihai-valentin/cling","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihai-valentin%2Fcling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihai-valentin%2Fcling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihai-valentin%2Fcling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihai-valentin%2Fcling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mihai-valentin","download_url":"https://codeload.github.com/mihai-valentin/cling/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihai-valentin%2Fcling/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29770766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T03:15:54.600Z","status":"ssl_error","status_checked_at":"2026-02-24T03:15:54.143Z","response_time":75,"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":["cli","framework","go","minimalistic"],"created_at":"2025-04-30T04:21:40.060Z","updated_at":"2026-02-24T03:31:12.820Z","avatar_url":"https://github.com/mihai-valentin.png","language":"Go","readme":"# Cling\n\n[![Build\u0026Test](https://github.com/mihai-valentin/cling/actions/workflows/test.yml/badge.svg)](https://github.com/mihai-valentin/cling/actions/workflows/test.yml)\n\nCling is a tiny CLI framework.\n\nCling treats CLI commands as Golang structs, providing full control over arguments and flags.\nAlso, Cling includes a simple validation system and a \"commands' registry\" abstraction.\nCommands' registry simplifies the process of running commands using `os.Args`.\n\n## Install\n\n```shell\ngo get github.com/mihai-valentin/cling\n```\n\n## Convention\n\n1. The command name must be passed as the second argument (e.g. `myapp command-name arg1=1 arg2=2`)\n2. All command's args must be named (e.g. `arg_name=arg_value`)\n3. All flags must be prefixed with a double dash (`--`)\n\n## How to\n\n1. Create a command struct based on the `cling.Command` abstraction\n2. Create a constructor function and declare args and flags. Optionally, add validation rules for args.\n   * Implement `GetArgs() []*cling.Arg` method if your command has args - return command's args\n   * Implement `GetFlags() []*cling.Flags` method if your command has flags - return command's flags\n3. Implement `Execute(input *Input) error` method - add the command logic there\n4. Create an empty commands registry or use an existing one. Register your command.\n5. Get the `os.Args` and run the command using the registry.\n\nTo learn more see `.exmaples` directory.\n\n## Unmarshal input struct into command\n\n```go\n// Unmarshal arg only\nerr := cling.UnmarshalArgs(input, command)\n\n// Unmarshal flags only\nerr := cling.UnmarshalFlags(input, command)\n\n// Unmarshal args and flags\nerr := cling.UnmarshalArgsAndFlags(input, command)\n```\n\n## Available args validation rules\n\n1. `int` arg value must be greater or equal to - `arg.Min(\u003cmin_value\u003e)`\n2. `int` arg value must be less or equal to - `arg.Max(\u003cmax_value\u003e)`\n3. `int` arg value must be between `a` and `b` - `arg.Range(\u003cmin_value\u003e, \u003cmax_value\u003e)`\n4. Blacklist `string` arg values - `arg.Blacklist(\"master\", \"prod\", \"etc\")`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihai-valentin%2Fcling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmihai-valentin%2Fcling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihai-valentin%2Fcling/lists"}