{"id":17443076,"url":"https://github.com/adrianrudnik/uritool","last_synced_at":"2025-03-01T20:31:06.842Z","repository":{"id":57639657,"uuid":"179279841","full_name":"adrianrudnik/uritool","owner":"adrianrudnik","description":"Command-line tool that helps with URI/URL handling and proper part extraction, escaping and parsing.","archived":false,"fork":false,"pushed_at":"2020-04-28T16:45:56.000Z","size":136,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2024-06-20T08:01:15.214Z","etag":null,"topics":["bash","cmd","golang","shell","snap","uri-parser","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrianrudnik.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}},"created_at":"2019-04-03T11:54:05.000Z","updated_at":"2024-05-16T17:19:32.000Z","dependencies_parsed_at":"2022-08-27T19:52:20.580Z","dependency_job_id":null,"html_url":"https://github.com/adrianrudnik/uritool","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Furitool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Furitool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Furitool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Furitool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianrudnik","download_url":"https://codeload.github.com/adrianrudnik/uritool/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":220105951,"owners_count":16595315,"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":["bash","cmd","golang","shell","snap","uri-parser","url-parser"],"created_at":"2024-10-17T16:43:19.803Z","updated_at":"2024-10-17T16:43:20.515Z","avatar_url":"https://github.com/adrianrudnik.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uritool\n\nCommand-line tool that helps with URI/URL handling and proper part extraction, escaping and parsing.  \n\n[![license](https://img.shields.io/github/license/adrianrudnik/uritool.svg)](https://lab.klonmaschine.de/adrian.rudnik/uritool/blob/develop/LICENSE)\n[![pipeline status](https://lab.klonmaschine.de/adrian.rudnik/uritool/badges/develop/pipeline.svg)](https://lab.klonmaschine.de/adrian.rudnik/uritool/commits/develop)\n[![coverage report](https://lab.klonmaschine.de/adrian.rudnik/uritool/badges/develop/coverage.svg)](https://lab.klonmaschine.de/adrian.rudnik/uritool/commits/develop)\n[![go report card](https://goreportcard.com/badge/github.com/adrianrudnik/uritool)](https://goreportcard.com/report/github.com/adrianrudnik/uritool)\n\n## Installation\n\nThe following methods are available:\n\n### Download\n\nDirectly download a version from the [release page](https://github.com/adrianrudnik/uritool/releases).\n\n### Snap\n\nInstall it on any system supporting snaps:\n\n```sh\nsnap install uritool\n```\n\n### Build yourself\n\nDownload the source code, review it and build it:\n\n```sh\ngo test ./...\ngo build -mod=vendor .\n```\n\nThis should build a local binary for your system with the name `uritool` in your current working directory.\n\n## Usage\n\n### Query commands\n\nEncodes the given value to a valid query parameter value:\n\n```sh\nuritool query escape --no-newline \"hello / world!%%\"\n\n# \u003e hello+%2F+world%25%25\n```\n\nDecodes the given escaped query value:\n\n```sh\nuritool query unescape \"hello+%2F+world%25%25\"\n\n# \u003e hello / world!%%\n```\n\n### Path commands\n\nEscape the given value to a valid escaped path value:\n\n```sh\nuritool path escape \"hello world\"\n\n# \u003e hello%20world\n``` \n\nUnescape the given escaped path value:\n\n```sh\nuritool path unescape \"hello%20world\"\n\n# \u003e hello world\n``` \n\n### Parse commands\n\nParse a given URI and return all information as JSON:\n\n```sh\nuritool parse uri \"https://my:pass@the.example.com:8080/what/ ever?this=is\u0026this=isnot#doing\"\n\n# \u003e {\n# \u003e   \"Scheme\": \"https\",\n# \u003e   \"Opaque\": \"\",\n# \u003e   \"Username\": \"my\",\n# \u003e   \"Password\": \"pass\",\n# \u003e   \"PasswordIsGiven\": true,\n# \u003e   \"Host\": \"the.example.com:8080\",\n# \u003e   \"Hostname\": \"the.example.com\",\n# \u003e   \"Port\": 8080,\n# \u003e   \"Path\": \"/what/ ever\",\n# \u003e   \"PathEscaped\": \"/what/%20ever\",\n# \u003e   \"RawQuery\": \"this=is\\u0026this=isnot\",\n# \u003e   \"Fragment\": \"doing\",\n# \u003e   \"Query\": {\n# \u003e     \"this\": [\n# \u003e       \"is\",\n# \u003e       \"isnot\"\n# \u003e     ]\n# \u003e   }\n# \u003e }\n```\n\nBut sometimes you just want a specific part or combination of it, so use can use the [go template](https://golang.org/pkg/text/template/) language:\n\n```sh\nuritool parse uri --format=\"Welcome {{.Username}} from {{.Hostname}}\" \"https://adrian:something@the.example.com:8080/?uh=oh\"\n\n# \u003e Welcome adrian from the.example.com\n\nuritool parse uri --format=\"Second entry is {{index .Query.things 1}}\" \"https://adrian:something@the.example.com:8080/?things=one\u0026things=two\"\n\n# \u003e Second entry is two\n```\n\nYou can also parse query strings (leading \"?\" will be removed):\n\n```sh\nuritool parse query \"?this=is\u0026this=isnot\"\n\n# \u003e {\n# \u003e   \"this\": [\n# \u003e     \"is\",\n# \u003e     \"isnot\"\n# \u003e   ]\n# \u003e }\n```\n\nThis is also workable with the [go template](https://golang.org/pkg/text/template/) language:\n\n```sh\nuritool parse query -n --format=\"{{index .search 0}}\" \"search=mister\u0026filter=x\"\n\n# \u003e mister\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianrudnik%2Furitool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianrudnik%2Furitool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianrudnik%2Furitool/lists"}