An open API service indexing awesome lists of open source software.

https://github.com/herloct/url-parser

A command-line URL parser, written in Go
https://github.com/herloct/url-parser

command-line-tool go golang parser url url-parser

Last synced: 22 days ago
JSON representation

A command-line URL parser, written in Go

Awesome Lists containing this project

README

          

# url-parser [![Build Status](https://travis-ci.org/herloct/url-parser.svg?branch=master)](https://travis-ci.org/herloct/url-parser) [![Build status](https://ci.appveyor.com/api/projects/status/x8ct5ewh1bi5l2og/branch/master?svg=true)](https://ci.appveyor.com/project/herloct/url-parser/branch/master)

Inspired by [urlp](https://github.com/clayallsopp/urlp), a simple command-line utility for parsing URLs.

Implemented in Go, using standard library.

```bash
$ url-parser --part=host https://somedomain.com
somedomain.com

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

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

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

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

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

## Instalation

url-parser is available for Linux and OS X, 64-bit only for now:

```curl
curl -L https://github.com/herloct/url-parser/releases/download/1.0.0-beta4/url-parser-`uname -s`-x86_64 > /usr/local/bin/url-parser; chmod +x /usr/local/bin/url-parser

```

For Windows, you could download them here:

```curl
https://github.com/herloct/url-parser/releases/download/1.0.0-beta4/url-parser-Windows-x86_64.exe
```

## Usage

```bash
$ url-parser --help
url-parser
Parse URL and shows the part of it.

Usage:
url-parser --part=PART
url-parser --part=path [--path-index=INDEX]
url-parser --part=query [--query-field=FIELD]

Options:
--part=PART Part of URL to show [default: all].
Valid values: all, scheme, user, password,
hostname, port, path, query, or fragment.
--path-index=INDEX Filter parsed path by index.
--query-field=FIELD Filter parsed query string by field name.
```