| Crates.io | urlmatic |
| lib.rs | urlmatic |
| version | 0.6.1 |
| created_at | 2022-05-19 01:08:42.791462+00 |
| updated_at | 2025-05-08 02:41:23.046839+00 |
| description | Slice and dice URLs on the command line |
| homepage | |
| repository | https://github.com/bww/urlmatic |
| max_upload_size | |
| id | 589436 |
| size | 32,440 |
Perform some useful manipulation of URLs, such as:
You can install URL-matic via Homebrew on macOS as follows:
$ brew install bww/stable/urlmatic
If you have a Rust toolchain installed, you can also install from Cargo:
$ cargo install urlmatic
Resolves a relative URL against the provided base URL and prints the result.
$ urlmatic resolve --base 'https://www.example.com/documents/letter.html?length=100' '../index.html?length=200'
> https://www.example.com/index.html?length=200
Removes the specified number of components from the end of a URL's path and prints the result.
$ urlmatic trim --count 2 'https://www.example.com/documents/letter.html?length=100'
> https://www.example.com/?length=100
Replace specific components in a URL and print the result.
$ urlmatic rewrite \
--username admin \
--host another.com \
--path /cgi-bin/q \
--query 'offset=0&length=100' \
--fragment 'anchor-name' \
https://example.com/query
> https://admin@another.com/cgi-bin/q?offset=0&length=100#anchor-name
x-www-form-urlencoded dataURL-encode form data form/query data.
$ urlmatic encode -k yep -v 👍 -k nope -v 👎
> yep=%F0%9F%91%8D&nope=%F0%9F%91%8E
$ urlmatic encode yep=👍 nope=👎
> nope=%F0%9F%91%8E&yep=%F0%9F%91%8D
x-www-form-urlencoded dataURL-decode form data and extract values.
$ urlmatic decode 'yep=%F0%9F%91%8D&nope=%F0%9F%91%8E'
> yep: 👍
> nope: 👎
$ urlmatic decode --select yep 'yep=%F0%9F%91%8D&nope=%F0%9F%91%8E'
> 👍
$ urlmatic decode --select nope,yep 'yep=%F0%9F%91%8D&nope=%F0%9F%91%8E'
> 👍
> 👎
Compose and modify a URL using a few commands.
$ echo 'https://example.com/path/to/query' |
urlmatic rewrite --host another.com --query $(urlmatic encode -k yep -v 👍) |
urlmatic trim --count 2
> https://another.com/path?yep=%F0%9F%91%8D