{"id":18384918,"url":"https://github.com/natata/cmds","last_synced_at":"2026-04-29T01:32:59.480Z","repository":{"id":80615102,"uuid":"135743147","full_name":"Natata/cmds","owner":"Natata","description":"A simple command service implement with grpc","archived":false,"fork":false,"pushed_at":"2018-06-01T18:38:38.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-23T00:31:54.150Z","etag":null,"topics":["commander","go","golang","grpc"],"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/Natata.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":"2018-06-01T16:58:58.000Z","updated_at":"2018-06-01T18:38:39.000Z","dependencies_parsed_at":"2023-07-08T02:46:06.858Z","dependency_job_id":null,"html_url":"https://github.com/Natata/cmds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Natata/cmds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Fcmds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Fcmds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Fcmds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Fcmds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Natata","download_url":"https://codeload.github.com/Natata/cmds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Fcmds/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32407164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: 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":["commander","go","golang","grpc"],"created_at":"2024-11-06T01:15:52.861Z","updated_at":"2026-04-29T01:32:59.473Z","avatar_url":"https://github.com/Natata.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cmds\nA simple command service implement with grpc.\n\n# How to use\n## Server side\n### Register actions for codes\n```\nset := cmds.Set{\n    1: func(s string) error {\n        if s == \"btc\" {\n            fmt.Println(\"mining\")\n            return nil \n        }   \n        return fmt.Errorf(\"wrong\")\n    },  \n    2: func(s string) error {\n        fmt.Println(s)\n        return nil \n    },  \n}   \ns := cmds.InitCMDS(set)\n```\n\n### Run the server\n```\naddr := \":8080\"\ns.Run(addr)\n```\n\n### Run the server with TLS\n```\ncredOpt, _ := cmds.CreateCred(*certFile, *keyFile)\naddr := \":8080\"\ns.Run(addr, credOpt)\n```\n\n## Client side\n\n### create client\n```\ncli, _ := client.InitClient(addr)\n```\n\n### create client with TLS\n```\ncred, _ := client.CreateCred(*certFile, *serverName)\ncli, _ := client.InitClient(addr, cred)\n```\n\n### send the code and param\n```\nerr = cli.Send(1, \"btc\")\nif err != nil {\n\tpanic(err)\n}\nfmt.Println(\"success\")\n\nerr = cli.Send(1, \"eth\")\nfmt.Println(err)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatata%2Fcmds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatata%2Fcmds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatata%2Fcmds/lists"}