pur
github.com/jordan-wright/purl
go get github.com/jordan-wright/purl
pur

github.com/jordan-wright/purl

A command-line URL parser

by Jordan Wright

v0.0.0-20180702033529-b76ba8f3ea22 (see all)License:MIT
go get github.com/jordan-wright/purl
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>]

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

GitHub Stars

11

LAST COMMIT

4yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.0.0-20180702033529-b76ba8f3ea22
1yr ago
No alternatives found
No tutorials found
Add a tutorial