Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grongor/go-url-parser
Simple library/CLI utility for parsing URLs (who wants to mess with sed/awk/cut/...). Supports "template" formatting.
https://github.com/grongor/go-url-parser
cli go golang parser unix url url-parser
Last synced: 4 months ago
JSON representation
Simple library/CLI utility for parsing URLs (who wants to mess with sed/awk/cut/...). Supports "template" formatting.
- Host: GitHub
- URL: https://github.com/grongor/go-url-parser
- Owner: grongor
- License: mit
- Created: 2019-11-23T21:24:03.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-06T17:31:28.000Z (6 months ago)
- Last Synced: 2024-10-12T13:39:33.792Z (4 months ago)
- Topics: cli, go, golang, parser, unix, url, url-parser
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
url-parser
==========```
url-parser
Parses given URLs and prints the desired parts of them.Usage:
url-parser [url]...Options:
-c, --component=COMPONENTPrints single URL component from each. URL.
Valid values: scheme, authority, auth, user, password,
hostport, host, tld, port, path, query,
fragment, basePath, file, ext, relativeUrlAdditionally, some components may be further formatted:
host:x, host:x:y print only desired (sub)domains
hostport:x, hostport:x:y same as host:*, but also includes port
path:x, path:x:y print only desired parts of the path
query:NAME print only query parameter named NAME
fragment:NAME print only fragment part named NAMEx starting position; use -x to start from end
y count; how many parts of the component you want to print-f, --format=FORMAT
Prints URLs formatted according to FORMAT.
FORMAT is an arbitrary string containing component placeholders
enclosed in curly brackets. Each {COMPONENT} will be replaced
as if url-parser was called with option -c COMPONENTExamples:
reference URL: https://www.example.com/lorem/ipsum/dolor/sit.html?metus=lectus#at=nostra&unde=omnis
url-parser -c host:1 example.com
url-parser -c path:-0:2 /dolor/sit.html
url-parser -c path:-1 /lorem/ipsum/dolor
url-parser -c path:0:2 /lorem/ipsum
url-parser -c fragment:unde unde=omnis
url-parser -c relativeUrl /lorem/ipsum/dolor/sit.html?metus=lectus#at=nostra&unde=omnis
url-parser -f {scheme}://{host} https://www.example.com
```