Skip to content

simonmittag/puri

Repository files navigation

puri ("parse uri") is a robust commandline utility that reads and extracts uri components. It processes URLs with and without schemes.

Circleci Builds Github Workflows Github Issues Github Activity
CodeClimate Maintainability CodeClimate Test Coverage Go Version License Version

What's New

v0.1.9

  • bugfix for url withouth proper paths

v0.1.8

  • bugfix for url paths containing domains

v0.1.7

  • added simple path parsing that makes this more intuitive over standard library interpretation

Up and running

Homebrew

brew tap simonmittag/cli &&
  brew install puri &&
  puri 

Golang

git clone https://github.com/simonmittag/puri && cd puri && 
go install github.com/simonmittag/puri/cmd/puri && 
puri 

Usage

~ λ puri
puri[v0.1.9]
Usage: puri [-s]|[-o]|[-r]|[-p]|[-q name]|[-h]|[-v] scheme://host:port#a?k=v
  -h	print usage instructions
  -o	extract host
  -p	extract path
  -q string
    	extract query param
  -r	extract port
  -s	extract scheme
  -v	print puri version

Examples

Get URI path without scheme specified

λ puri -p bar.com/foo?k=foo
  /foo

Get URI host without scheme specified

λ puri -o bar.com?k=foo
  bar.com

Get URI query param

λ puri -q k https://www.bar.com?k=foo
  foo

Get URI path (includes anchor)

λ puri -p https://www.foo.com/q#bar?k=v
  /q#bar

Contributions

The puri team welcomes all contributors. Everyone interacting with the project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct