You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
renovate[bot] ba386afbb5 chore(deps): update dependency golangci/golangci-lint to v1.48.0 7 days ago
.chglog chore: adjust changelog template to link to prs instead of issues (#17) 8 months ago
.github fix worind in readme and adjust repo config 4 weeks ago
cmd/url-parser ci: refactor build tools and ci setup (#24) 4 months ago
internal/command ci: refactor build tools and ci setup (#24) 4 months ago
.dockerignore ci: refactor build tools and ci setup (#24) 4 months ago
.drone.jsonnet chore: switch to go1.19 (#37) 1 week ago
.drone.yml chore: switch to go1.19 (#37) 1 week ago
.gitignore ci: refactor build tools and ci setup (#24) 4 months ago
.golangci.yml ci: refactor build tools and ci setup (#24) 4 months ago
.prettierignore chore: end of the year maintenance 8 months ago
CONTRIBUTING.md docs: add contributing information 2 years ago
LICENSE chore: end of the year maintenance 8 months ago
Makefile chore(deps): update dependency golangci/golangci-lint to v1.48.0 7 days ago
README.md docs: fix spelling in readme 1 month ago
go.mod fix(deps): update module github.com/urfave/cli/v2 to v2.11.1 (#34) 1 week ago
go.sum fix(deps): update module github.com/urfave/cli/v2 to v2.11.1 (#34) 1 week ago
renovate.json fix renovate preset config 8 months ago

README.md

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

make build

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 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.