{"id":3587865,"name":"github.com/tebeka/flags","ecosystem":"go","description":"Package flags adds various types for command line flags (Time, URL, File ...) Example: package flags_test import ( \"flag\" \"fmt\" \"net/url\" \"os\" \"time\" \"github.com/tebeka/flags\" ) var config struct { in *os.File name string port int start time.Time retries int url *url.URL } func ExampleUsage() { fs := flag.NewFlagSet(\"example\", flag.ContinueOnError) flags := flags.New(fs) flags.File(config.in, 'r', \"input\", \"input file\") flags.Int(\u0026config.retries, checkRetries, \"retries\", \"number of retries\") flags.Port(\u0026config.port, \"port\", \"port to listen on\") flags.String(\u0026config.name, checkName, \"name\", \"logger name\") flags.Time(\u0026config.start, time.RFC3339, \"start\", \"start time\") flags.URL(config.url, \"url\", \"url to hit\") args := []string{ \"-input\", \"/dev/null\", \"-name\", \"lassie\", \"-port\", \"999\", \"-retries\", \"3\", \"-start\", \"2019-11-26T19:23:42Z\", \"-url\", \"http://example.com\", } fs.Parse(args) fmt.Printf(\"in: %q\\n\", config.in.Name()) fmt.Printf(\"name: %q\\n\", config.name) fmt.Printf(\"port: %d\\n\", config.port) fmt.Printf(\"retries: %d\\n\", config.retries) fmt.Printf(\"start: %s\\n\", config.start) fmt.Printf(\"url: %q\\n\", config.url.String()) // Output: // in: \"/dev/null\" // name: \"lassie\" // port: 999 // retries: 3 // start: 2019-11-26 19:23:42 +0000 UTC // url: \"http://example.com\" } func checkRetries(n int) error { if n \u003c 0 || n \u003e 10 { return fmt.Errorf(\"retries = %d not in range [0:10]\", n) } return nil } func checkName(s string) error { if len(s) == 0 { return fmt.Errorf(\"empty name\") } return nil } func init() { // Set defaults config.in = os.Stdin config.name = \"bugs\" config.port = 8080 config.retries = 1 config.start = time.Now() config.url, _ = url.Parse(\"http://localhost:8080\") }","homepage":"https://github.com/tebeka/flags","licenses":"mit","normalized_licenses":["MIT"],"repository_url":"https://github.com/tebeka/flags","keywords_array":[],"namespace":"github.com/tebeka","versions_count":9,"first_release_published_at":"2019-11-26T18:23:51.000Z","latest_release_published_at":"2022-04-14T14:59:51.000Z","latest_release_number":"v0.4.0","last_synced_at":"2026-09-01T21:06:47.028Z","created_at":"2022-04-11T04:52:31.905Z","updated_at":"2026-09-08T20:45:49.169Z","registry_url":"https://pkg.go.dev/github.com/tebeka/flags","install_command":"go get github.com/tebeka/flags","documentation_url":"https://pkg.go.dev/github.com/tebeka/flags#section-documentation","metadata":{},"repo_metadata":{"id":66341399,"uuid":"224237491","full_name":"tebeka/flags","owner":"tebeka","description":"Useful command line flag types for Go (File, URL, Time ...)","archived":false,"fork":false,"pushed_at":"2025-08-07T06:36:10.000Z","size":48,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-09-01T20:58:37.876Z","etag":null,"topics":["command-line","flags","go","golang"],"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/tebeka.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,"zenodo":null}},"created_at":"2019-11-26T16:29:00.000Z","updated_at":"2026-04-22T17:45:57.000Z","dependencies_parsed_at":"2025-08-07T08:18:33.742Z","dependency_job_id":null,"html_url":"https://github.com/tebeka/flags","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tebeka/flags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tebeka","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":341189360,"owners_count":37168771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-22T15:14:58.755Z","status":"online","status_checked_at":"2026-09-08T02:00:05.531Z","response_time":108,"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"},"owner_record":{"login":"tebeka","name":"Miki Tebeka","uuid":"87697","kind":"user","description":"A person (arguably)\r\n\r\nalso CEO of @353solutions ","email":"","website":"https://www.353solutions.com","location":"Israel ","twitter":"tebeka","company":"353solutions","icon_url":"https://avatars.githubusercontent.com/u/87697?v=4","repositories_count":64,"last_synced_at":"2023-04-10T17:40:51.158Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/tebeka","funding_links":[],"total_stars":null,"followers":null,"following":null,"created_at":"2022-11-02T16:51:50.509Z","updated_at":"2023-04-10T17:40:51.194Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tebeka","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tebeka/repositories"},"tags":[{"name":"v0.4.0","sha":"bfb20097a271c972bc0ee61de5c543403eaeccbb","kind":"commit","published_at":"2022-04-14T14:59:51.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.4.0","html_url":"https://github.com/tebeka/flags/releases/tag/v0.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.4.0/manifests"},{"name":"v0.3.0","sha":"e9799aaad3b97e7481e9d1d4f104dc4aff857ab1","kind":"commit","published_at":"2020-03-19T19:41:55.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.3.0","html_url":"https://github.com/tebeka/flags/releases/tag/v0.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.3.0/manifests"},{"name":"v0.2.1","sha":"fe49383fe1d60205b31e127d728f167849aa4c6e","kind":"commit","published_at":"2019-12-05T10:13:51.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.2.1","html_url":"https://github.com/tebeka/flags/releases/tag/v0.2.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.2.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.2.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.2.1/manifests"},{"name":"v0.2.0","sha":"bef8f60023a28ac9212a913561b1436e9b8dce46","kind":"commit","published_at":"2019-12-05T09:44:00.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.2.0","html_url":"https://github.com/tebeka/flags/releases/tag/v0.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.2.0/manifests"},{"name":"v0.1.4","sha":"965be2cae5567ad9671e3128e4040edddfdc86ac","kind":"commit","published_at":"2019-12-01T15:33:19.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.1.4","html_url":"https://github.com/tebeka/flags/releases/tag/v0.1.4","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.1.4","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.4","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.4/manifests"},{"name":"v0.1.3","sha":"3389bdf2d88e003eacea7660e19c5b2addc9404c","kind":"commit","published_at":"2019-11-27T06:48:02.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.1.3","html_url":"https://github.com/tebeka/flags/releases/tag/v0.1.3","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.1.3","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.3","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.3/manifests"},{"name":"v0.1.2","sha":"00e66db52418f1569a1c5f49fbd6535320aecd2c","kind":"commit","published_at":"2019-11-27T06:34:18.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.1.2","html_url":"https://github.com/tebeka/flags/releases/tag/v0.1.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.1.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.2/manifests"},{"name":"v0.1.1","sha":"10780b801476e3149434ecfa8e951cd44770439f","kind":"commit","published_at":"2019-11-26T18:30:51.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.1.1","html_url":"https://github.com/tebeka/flags/releases/tag/v0.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.1/manifests"},{"name":"v0.1.0","sha":"48f1d58de90e4e40271e37b13d21b1b1f25016ba","kind":"commit","published_at":"2019-11-26T18:23:51.000Z","download_url":"https://codeload.github.com/tebeka/flags/tar.gz/v0.1.0","html_url":"https://github.com/tebeka/flags/releases/tag/v0.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/tebeka/flags@v0.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/tags/v0.1.0/manifests"}]},"repo_metadata_updated_at":"2026-09-08T20:45:49.168Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":1,"rankings":{"downloads":null,"dependent_repos_count":4.737783823480656,"dependent_packages_count":9.575730298247606,"stargazers_count":11.104812732106154,"forks_count":18.69806636855636,"docker_downloads_count":null,"average":11.029098305597694},"purl":"pkg:golang/github.com/tebeka/flags","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/go/github.com/tebeka/flags","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/go/github.com/tebeka/flags","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/go/github.com/tebeka/flags/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":{"last_synced_at":"2026-09-01T20:58:38.101Z","issues_count":1,"pull_requests_count":1,"avg_time_to_close_issue":165967.0,"avg_time_to_close_pull_request":365.0,"issues_closed_count":1,"pull_requests_closed_count":1,"pull_request_authors_count":1,"issue_authors_count":1,"avg_comments_per_issue":0.0,"avg_comments_per_pull_request":0.0,"merged_pull_requests_count":1,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":0,"past_year_pull_requests_count":0,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":0,"past_year_pull_request_authors_count":0,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":null,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":0,"issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebeka%2Fflags/issues","maintainers":[{"login":"tebeka","count":2,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/tebeka"}],"active_maintainers":[]},"versions_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Ftebeka%2Fflags/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Ftebeka%2Fflags/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Ftebeka%2Fflags/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Ftebeka%2Fflags/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Ftebeka%2Fflags/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Ftebeka%2Fflags/codemeta","maintainers":[]}