https://github.com/herloct/url-parser
A command-line URL parser, written in Go
https://github.com/herloct/url-parser
command-line-tool go golang parser url url-parser
Last synced: 22 days ago
JSON representation
A command-line URL parser, written in Go
- Host: GitHub
- URL: https://github.com/herloct/url-parser
- Owner: herloct
- License: mit
- Created: 2017-07-13T08:55:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-17T07:13:37.000Z (over 8 years ago)
- Last Synced: 2024-06-20T10:13:49.802Z (over 1 year ago)
- Topics: command-line-tool, go, golang, parser, url, url-parser
- Language: Go
- Size: 6.84 KB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- command-line-tools - url-parser - Command-line URL parser, written in Go. (Other)
README
# url-parser [](https://travis-ci.org/herloct/url-parser) [](https://ci.appveyor.com/project/herloct/url-parser/branch/master)
Inspired by [urlp](https://github.com/clayallsopp/urlp), a simple command-line utility for parsing URLs.
Implemented in Go, using standard library.
```bash
$ url-parser --part=host https://somedomain.com
somedomain.com
$ url-parser --part=user https://herloct@somedomain.com
herloct
$ url-parser --part=path https://somedomain.com/path/to
/path/to
$ url-parser --part=path --path-index=1 https://somedomain.com/path/to
to
$ url-parser --part=query https://somedomain.com/?some-key=somevalue
some-key=somevalue
$ url-parser --part=query --query-field=some-key https://somedomain.com/?some-key=somevalue
somevalue
```
## Instalation
url-parser is available for Linux and OS X, 64-bit only for now:
```curl
curl -L https://github.com/herloct/url-parser/releases/download/1.0.0-beta4/url-parser-`uname -s`-x86_64 > /usr/local/bin/url-parser; chmod +x /usr/local/bin/url-parser
```
For Windows, you could download them here:
```curl
https://github.com/herloct/url-parser/releases/download/1.0.0-beta4/url-parser-Windows-x86_64.exe
```
## Usage
```bash
$ url-parser --help
url-parser
Parse URL and shows the part of it.
Usage:
url-parser --part=PART
url-parser --part=path [--path-index=INDEX]
url-parser --part=query [--query-field=FIELD]
Options:
--part=PART Part of URL to show [default: all].
Valid values: all, scheme, user, password,
hostname, port, path, query, or fragment.
--path-index=INDEX Filter parsed path by index.
--query-field=FIELD Filter parsed query string by field name.
```