{"id":15517311,"url":"https://github.com/skx/subcommands","last_synced_at":"2026-01-27T11:31:46.040Z","repository":{"id":57519205,"uuid":"218564294","full_name":"skx/subcommands","owner":"skx","description":"Easy subcommand handling for a golang based command-line application","archived":false,"fork":false,"pushed_at":"2022-01-01T10:19:17.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T03:52:09.519Z","etag":null,"topics":["cli","golang","library","subcommands","utility"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"skx","custom":"https://steve.fi/donate/"}},"created_at":"2019-10-30T15:49:27.000Z","updated_at":"2022-06-28T09:17:50.000Z","dependencies_parsed_at":"2022-09-06T05:10:55.527Z","dependency_job_id":null,"html_url":"https://github.com/skx/subcommands","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/skx/subcommands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsubcommands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsubcommands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsubcommands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsubcommands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skx","download_url":"https://codeload.github.com/skx/subcommands/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsubcommands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28812389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"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","golang","library","subcommands","utility"],"created_at":"2024-10-02T10:12:28.073Z","updated_at":"2026-01-27T11:31:46.024Z","avatar_url":"https://github.com/skx.png","language":"Go","readme":"[![GoDoc](https://godoc.org/github.com/skx/subcommands?status.svg)](http://godoc.org/github.com/skx/subcommands)\n[![Go Report Card](https://goreportcard.com/badge/github.com/skx/subcommands)](https://goreportcard.com/report/github.com/skx/subcommands)\n[![license](https://img.shields.io/github/license/skx/subcommands.svg)](https://github.com/skx/subcommands/blob/master/LICENSE)\n[![Release](https://img.shields.io/github/release/skx/subcommands.svg)](https://github.com/skx/subcommands/releases/latest)\n\n\n# subcommands\n\nThis is a simple package which allows you to write a CLI with distinct subcommands.\n\n\n## Overview\n\nUsing this library you can enable your command-line application to have a number of subcommands, allowing things like this to be executed:\n\n    $ application one\n    $ application two [args]\n    $ application help\n\nIn addition to allowing the user to specify a sub-command via the first argument it will also allow a default to be used if your binary has the same name as a sub-command.\n\nFor example if you had a binary named `gobox` you could create a symlink called `ls`:\n\n    $ ln -s gobox ls\n    $ ./ls\n\nHere running `ls` is the same as running `gobox ls`, and argument parsing would work the same too:\n\n    $ gobox ls --foo\n    $ ./ls --foo\n\n\n## Bash Completion\n\nAll applications using this library will find it easy to generate a bash-completion script, via the following addition to their init-file:\n\n    $ source \u003c(application bash-completion)\n\nThe generated completion-script will allow TAB-completion of the sub-commands, as well as their options.\n\n\n\n## Rationale\n\nThere are several frameworks for building a simple CLI application, such as Corba.  But those are relatively heavyweight.\n\nThis is designed to implement the minimum required support:\n\n* Allow an application to register sub-commands:\n  * `foo help`\n    * Show help\n  * `foo version`\n    * Show the version\n  * `foo server`\n    * Launch a HTTP-server\n  * etc.\n* Allow flags to be defined on a per-subcommand basis.\n* Allow the sub-commands to process any remaining arguments.\n* Allow trivial bash-completion scripts to be generated.\n\n\n## Example\n\nThere is a simple example defined in [_example/main.go](_example/main.go).\n","funding_links":["https://github.com/sponsors/skx","https://steve.fi/donate/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskx%2Fsubcommands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskx%2Fsubcommands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskx%2Fsubcommands/lists"}