Go to file
2021-12-12 13:14:39 +01:00
.chglog chore: adjust changelog template to link to prs instead of issues (#17) 2021-12-12 13:14:39 +01:00
.github disable require branches to be up to date 2021-05-25 17:44:06 +02:00
cmd/url-parser chore: update build env to golang 1.16 (#11) 2021-05-10 09:03:54 +02:00
internal/command refactoring 2020-09-21 20:24:51 +02:00
.drone.jsonnet improve drone-matrix template 2021-09-22 09:57:45 +02:00
.drone.yml improve drone-matrix template 2021-09-22 09:57:45 +02:00
.gitignore ci: auto-generate changelog (#6) 2021-02-15 21:18:08 +01:00
.prettierignore chore: improve generated changelog (#10) 2021-05-09 23:46:56 +02:00
codecov.yml chore(devel): add codecov config file 2021-01-06 18:14:50 +01:00
CONTRIBUTING.md docs: add contributing information 2021-01-04 16:48:00 +01:00
go.mod fix(deps): update module honnef.co/go/tools to v0.2.2 (#16) 2021-11-11 19:55:09 +01:00
go.sum fix(deps): update module honnef.co/go/tools to v0.2.2 (#16) 2021-11-11 19:55:09 +01:00
LICENSE update year in license file 2021-01-04 16:36:54 +01:00
README.md docs: add build instructions 2021-10-25 12:48:09 +02:00
renovate.json chore: use renovate preset config 2021-01-04 16:43:55 +01:00

url-parser

Build Status Go Report Card Codecov GitHub contributors License: MIT

Inspired by herloct/url-parser, a simple command-line utility for parsing URLs.

Installation

Prebuild multiarch binaries are availabe for Linux only:

curl -L https://github.com/thegeeklab/url-parser/releases/download/v0.1.0/url-parser-0.1.0-linux-amd64 > /usr/local/bin/url-parser
chmod +x /usr/local/bin/url-parser
url-parser --help

Build

Build the binary from source with the following command:

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on

go build -v -a -tags netgo -o release/url-parser ./cmd/url-parser/

Usage

$ url-parser --help
NAME:
   url-parser - Parse URL and shows the part of it.

USAGE:
   url-parser [global options] command [command options] [arguments...]

VERSION:
   devel

COMMANDS:
   all, a        Get all parts from url
   scheme, s     Get scheme from url
   user, u       Get username from url
   password, pw  Get password from url
   path, pt      Get path from url
   host, h       Get hostname from url
   port, p       Get port from url
   query, q      Get query from url
   fragment, f   Get fragment from url
   help, h       Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --url value    source url to parse [$URL_PARSER_URL]
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

Examples

$ url-parser host --url https://somedomain.com
somedomain.com

$ url-parser user --url https://herloct@somedomain.com
herloct

$ url-parser path --url https://somedomain.com/path/to
/path/to

$ url-parser path --path-index=1 --url https://somedomain.com/path/to
to

$ url-parser query --url https://somedomain.com/?some-key=somevalue
some-key=somevalue

$ url-parser query --query-field=some-key --url https://somedomain.com/?some-key=somevalue
somevalue

Contributors

Special thanks goes to all contributors. If you would like to contribute, please see the instructions.

License

This project is licensed under the MIT License - see the LICENSE file for details.