{"id":27860964,"url":"https://github.com/stevencyb/gocli","last_synced_at":"2025-05-04T18:25:17.008Z","repository":{"id":288379919,"uuid":"967860684","full_name":"StevenCyb/GoCLI","owner":"StevenCyb","description":"A simple CLI library for GoLang","archived":false,"fork":false,"pushed_at":"2025-04-17T05:50:23.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-17T20:11:04.181Z","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/StevenCyb.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-17T05:48:31.000Z","updated_at":"2025-04-17T05:50:27.000Z","dependencies_parsed_at":"2025-04-17T20:11:12.426Z","dependency_job_id":"404245f4-1e31-4c32-846c-e6d3244abf5c","html_url":"https://github.com/StevenCyb/GoCLI","commit_stats":null,"previous_names":["stevencyb/gocli"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2FGoCLI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2FGoCLI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2FGoCLI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2FGoCLI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevenCyb","download_url":"https://codeload.github.com/StevenCyb/GoCLI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252379403,"owners_count":21738566,"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":"2025-05-04T18:25:16.299Z","updated_at":"2025-05-04T18:25:16.999Z","avatar_url":"https://github.com/StevenCyb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Structure\n\nThis is a simple CLI tool that can be configured as seen in the chart below.\n\n``` mermaid\nflowchart LR\nCLI[cli] --\u003e COMMAND[commands]\nCOMMAND --\u003e OPTIONS[options]\nCOMMAND --\u003e SUBCOMMAND[subcommands 1]\nSUBCOMMAND2 --\u003e ARGS\nSUBCOMMAND --\u003e ARGS\nCOMMAND --\u003e ARGS[args]\nSUBCOMMAND --\u003e SUBCOMMAND2[subcommands ...N]\nSUBCOMMAND --\u003e OPTIONS\nSUBCOMMAND2 --\u003e OPTIONS\nARGS --\u003e OPTIONS\nCLI --\u003e OPTIONS\nCLI --\u003e ARGS\n```\n\n## Installation\n```bash\nget get github.com/StevenCyb/GoCLI\n```\n\n## Examples\n```go\nfunc main() {\n\tc := cli.New(\n\t\tcli.Name(\"gurl\"),\n\t\tcli.Banner(`╔═╗╔═╗┬ ┬┬─┐┬\n║ ╦║  │ │├┬┘│\n╚═╝╚═╝└─┘┴└─┴─┘`),\n\t\tcli.Description(\"A simple CLI for making HTTP requests\"),\n\t\tcli.Version(\"1.0.0\"),\n\t\tcli.Command(\n\t\t\t\"get\", cli.Argument(\n\t\t\t\t\"url\",\n\t\t\t\tcli.Validate(regexp.MustCompile(`^https?://[^\\s/$.?#].[^\\s]*$`)),\n\t\t\t\tcli.Description(\"The URL to get\"),\n\t\t\t\tcli.Handler(\n\t\t\t\t\tfunc(ctx *cli.Context) error {\n\t\t\t\t\t\turl := ctx.GetArgument(\"url\")\n\t\t\t\t\t\tfmt.Printf(\"Perform [GET] %s\\n\", *url)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t\tcli.Option(\n\t\t\t\t\t\"verbose\",\n\t\t\t\t\tcli.Short('v'),\n\t\t\t\t\tcli.Default(\"\"),\n\t\t\t\t),\n\t\t\t),\n\t\t\tcli.Description(\"Get a resource\"),\n\t\t\tcli.Example(\"cli get http://example.com\"),\n\t\t),\n\t\tcli.Command(\n\t\t\t\"post\", cli.Argument(\n\t\t\t\t\"url\",\n\t\t\t\tcli.Validate(regexp.MustCompile(`^https?://[^\\s/$.?#].[^\\s]*$`)),\n\t\t\t\tcli.Description(\"The URL to post\"),\n\t\t\t\tcli.Handler(\n\t\t\t\t\tfunc(ctx *cli.Context) error {\n\t\t\t\t\t\turl := ctx.GetArgument(\"url\")\n\t\t\t\t\t\tbodyFile := ctx.GetOption(\"verbose\")\n\t\t\t\t\t\tfmt.Printf(\"Perform [POST] %s\\n\", *url)\n\t\t\t\t\t\tif bodyFile != nil {\n\t\t\t\t\t\t\tfmt.Printf(\"\\t With %s\\n\", *bodyFile)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t\tcli.Option(\n\t\t\t\t\t\"body_file\",\n\t\t\t\t\tcli.Short('b'),\n\t\t\t\t),\n\t\t\t\tcli.Option(\n\t\t\t\t\t\"verbose\",\n\t\t\t\t\tcli.Short('v'),\n\t\t\t\t\tcli.Default(\"\"),\n\t\t\t\t),\n\t\t\t),\n\t\t\tcli.Description(\"Get a resource\"),\n\t\t\tcli.Example(\"cli get http://example.com\"),\n\t\t),\n\t\t// ...\n\t\tcli.Command(\n\t\t\t\"version\", cli.Handler(\n\t\t\t\tfunc(_ *cli.Context) error {\n\t\t\t\t\tfmt.Println(\"1.0.0\")\n\t\t\t\t\treturn nil\n\t\t\t\t},\n\t\t\t),\n\t\t\tcli.Description(\"Get the version of the CLI\"),\n\t\t),\n\t)\n\n\t_, err := c.RunWith(os.Args)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tc.PrintHelp()\n\t\tos.Exit(1)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevencyb%2Fgocli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevencyb%2Fgocli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevencyb%2Fgocli/lists"}