{"id":15871177,"url":"https://github.com/sgreben/url","last_synced_at":"2026-01-19T08:31:41.272Z","repository":{"id":80988995,"uuid":"121871335","full_name":"sgreben/url","owner":"sgreben","description":"command-line URL parser. single binary, no dependencies. osx \u0026 linux \u0026 windows.","archived":false,"fork":false,"pushed_at":"2018-06-08T17:06:33.000Z","size":183,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T12:30:39.324Z","etag":null,"topics":["json","stdout","url-parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgreben.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}},"created_at":"2018-02-17T16:30:45.000Z","updated_at":"2023-09-08T17:36:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6e58a87-a5b0-41f2-8561-a1fd94e26a0c","html_url":"https://github.com/sgreben/url","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sgreben/url","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Furl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Furl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Furl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Furl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgreben","download_url":"https://codeload.github.com/sgreben/url/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Furl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28564011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"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":["json","stdout","url-parser"],"created_at":"2024-10-06T00:42:07.866Z","updated_at":"2026-01-19T08:31:41.256Z","avatar_url":"https://github.com/sgreben.png","language":"Go","readme":"# url - command-line URL parser\n\n`url` parses its arguments as URLs and prints a structured representation (JSON or go template) to stdout.\n\n![print output](docs/print.png)\n![JSON output](docs/json.png)\n\n- [Get it](#get-it)\n- [Use it](#use-it)\n    - [JSON output](#json-output)\n    - [Template output](#template-output)\n    - [Setting URL components](#setting-url-components)\n- [Comments](https://github.com/sgreben/url/issues/1)\n\n## Get it\n\nUsing go get:\n\n```bash\ngo get -u github.com/sgreben/url/cmd/url\n```\n\nOr [download the binary](https://github.com/sgreben/url/releases/latest) from the releases page. \n\n```bash\n# Linux\ncurl -L https://github.com/sgreben/url/releases/download/1.1.3/url_1.1.3_linux_x86_64.tar.gz | tar xz\n\n# OS X\ncurl -L https://github.com/sgreben/url/releases/download/1.1.3/url_1.1.3_osx_x86_64.tar.gz | tar xz\n\n# Windows\ncurl -LO https://github.com/sgreben/url/releases/download/1.1.3/url_1.1.3_windows_x86_64.zip\nunzip url_1.1.3_windows_x86_64.zip\n```\n\nAlso available as a [docker image](https://quay.io/repository/sergey_grebenshchikov/url?tab=tags):\n\n```bash\ndocker pull quay.io/sergey_grebenshchikov/url\n```\n\n## Use it\n\n`url` reads URLs from CLI arguments and writes to stdout.\n\n```text\nUsage of url:\n  -t string\n    \talias for -template\n  -template string\n    \tgo template output\n  -p\talias for -plain\n  -plain\n    \tplain URL output (useful with -set-* flags)\n  -r\talias for -resolve\n  -resolve\n    \tresolve ../ in URLs\n  -set-fragment value\n    \tset the fragment component\n  -set-host value\n    \tset the host component\n  -set-hostname value\n    \tset the hostname component\n  -set-opaque value\n    \tset the opaque component\n  -set-path value\n    \tset the path component\n  -set-port value\n    \tset the port component\n  -set-query value\n    \tset the (raw) query component\n  -set-scheme value\n    \tset the scheme component\n  -set-username value\n  -set-no-username\n        set the username component\n  -set-password value\n  -set-no-password\n        set the password component\n  -version\n    \tprint version and exit\n```\n\n### JSON output\n\nThe default output format is JSON, one object per line:\n\n```bash\n$ url https://github.com/sgreben/url/cmd/url\n```\n\n```json\n{\"scheme\":\"https\",\"hostname\":\"github.com\",\"host\":\"github.com\",\"path\":\"/sgreben/url/cmd/url\",\"pathComponents\":[\"sgreben\",\"url\",\"cmd\",\"url\"],\"query\":{},\"port\":\"\",\"fragment\":\"\"}\n```\n\n### Template output\n\nYou can specify an output template using the `-template` parameter and [go template](https://golang.org/pkg/text/template) syntax:\n\n```bash\n$ url -t .Hostname https://github.com/sgreben/url/cmd/url\n```\n\n```text\ngithub.com\n```\n\nThe fields available to the template are specified in the [`flatURL` struct](cmd/url/main.go#L15).\n\n### Setting URL components\n\nYou can modify the URLs before they are printed using the `-set-*` parameters. This probably most useful together with the `-p` (plain URL) output:\n\n```bash\n$ url -p -set-port 443 https://github.com/sgreben/url/cmd/url\n```\n\n```text\nhttps://github.com:443/sgreben/url/cmd/url\n```\n\nThis can also be used to build URLs:\n\n```bash\n$ url -p -set-host github.com -set-scheme https -set-path /sgreben/url/cmd/url \"\"\n```\n\n```text\nhttps://github.com/sgreben/url/cmd/url\n```\n\n## Comments\n\nFeel free to [leave a comment](https://github.com/sgreben/url/issues/1) or create an issue.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgreben%2Furl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgreben%2Furl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgreben%2Furl/lists"}