https://github.com/jordan-wright/purl
A command-line URL parser
https://github.com/jordan-wright/purl
Last synced: about 1 year ago
JSON representation
A command-line URL parser
- Host: GitHub
- URL: https://github.com/jordan-wright/purl
- Owner: jordan-wright
- License: mit
- Created: 2018-06-30T16:01:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-02T03:35:32.000Z (almost 8 years ago)
- Last Synced: 2025-03-25T03:23:25.369Z (over 1 year ago)
- Language: Go
- Size: 8.79 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purl
A command-line URL parser.
### Usage
`purl` reads URLs from stdin, parses them according to the provided flags, and prints the result to stdout.
```
usage: purl []
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--scheme Print the URL scheme
--opaque Print the opaque URL part
--user Print the user and password information
--host Print the URL hostname
--path Print the URL path
--query Print the URL query
--fragment Print the URL fragment
--separator=SEPARATOR Separate results by a delimeter
```
### Examples
Print the hostname
```
$ echo "https://google.com/test" | purl --host
google.com
```
Print the scheme and hostname
```
$ echo "https://google.com/test/?q=test" | purl --scheme --host
https://google.com
```
Print the hostname and path
```
$ echo "https://google.com/test/?q=test" | purl --host --path
google.com/test/
```
Print the user:password information:
```
$ echo "https://jordan-wright:password@google.com/test" | purl --user
jordan-wright:password
```
Use a comma separator:
```
$ echo "https://jordan-wright:password@google.com/test" | purl --user --host --path --separator ,
jordan-wright:password,google.com,/test
```
### Build From Source
To build from source, simply `go get` the package:
```
go get github.com/jordan-wright/purl
```