Usage: trurl [options] [URL]
-a, --append [component]=[data] - append data to component
--accept-space - give in to this URL abuse
--as-idn - encode hostnames in idn
--curl - only schemes supported by libcurl
--default-port - add known default ports
-f, --url-file [file/-] - read URLs from file or stdin
-g, --get [{component}s] - output component(s)
-h, --help - this help
--iterate [component]=[list] - create multiple URL outputs
--json - output URL as JSON
--keep-port - keep known default ports
--no-guess-scheme - require scheme in URLs
--punycode - encode hostnames in punycode
--qtrim [what] - trim the query
--query-separator [letter] - if something else than '&'
--quiet - Suppress (some) notes and comments
--redirect [URL] - redirect to this
--replace [data] - replaces a query [data]
--replace-append [data] - appends a new query if not found
-s, --set [component]=[data] - set component content
--sort-query - alpha-sort the query pairs
--url [URL] - URL to work with
--urlencode - show components URL encoded
-v, --version - show version
--verify - return error on (first) bad URL
URL COMPONENTS:
url, scheme, user, password, options, host, port, path, query, fragment, zoneid
Options (24)
| Option | Description | Source |
|---|
-a, --append component]=[data | - append data to component | help |
--accept-space | When set, trurl tries to accept spaces as part of the URL and instead URL encode such occurrences accordingly. | help + man |
--as-idn | Converts a punycode ASCII hostname to its original International Domain Name in Unicode. | help + man |
--curl | Only accept URL schemes supported by libcurl. | help + man |
--default-port | When set, trurl uses the scheme's default port number for URLs with a known scheme, and without an explicit port number. | help + man |
-f, --url-file file/- | - read URLs from file or stdin | help |
-g, --get component}s | - output component(s) | help |
-h, --help | Show the help output. | help + man |
--json | Outputs all set components of the URLs as JSON objects. | help + man |
--keep-port | By default, trurl removes default port numbers from URLs with a known scheme even if they are explicitly specified in the input URL. | help + man |
--no-guess-scheme | Disables libcurl's scheme guessing feature. | help + man |
--punycode | Uses the punycode version of the hostname, which is how International Domain Names are converted into plain ASCII. | help + man |
--qtrim what | - trim the query | help |
--query-separator letter | - if something else than '&' | help |
--quiet | - Suppress (some) notes and comments | help + man |
--redirect URL | - redirect to this | help |
--replace data | - replaces a query [data] | help |
--replace-append data | - appends a new query if not found | help |
-s, --set component]=[data | - set component content | help |
--sort-query | The "variable=content" tuplets in the query component are sorted in a case insensitive alphabetical order. | help + man |
--url URL | Set the input URL to work with. | help + man |
--urlencode | Outputs URL encoded version of components by default when using --get or --json. | help + man |
-v, --version | Show version information and exit. | help + man |
--verify | When a URL is provided, return error immediately if it does not parse as a valid URL. | help + man |
Exit status (12) from the manual page
1 | A problem with --url-file |
2 | A problem with --append |
3 | A command line option misses an argument |
4 | A command line option mistake or an illegal option combination. |
5 | A problem with --set |
6 | Out of memory |
7 | Could not output a valid URL |
8 | A problem with --qtrim |
9 | If --verify is set and the input URL cannot parse. |
10 | A problem with --get |
11 | A problem with --iterate |
12 | A problem with --replace or --replace-append |
Examples (16) from the manual page, untested
trurl --url https://curl.se --set host=example.com
Replace the hostname of a URLtrurl --set host=example.com --set scheme=ftp
Create a URL by setting componentstrurl --url https://curl.se/we/are.html --redirect here.html
Redirect a URLtrurl --url https://curl.se/we/../are.html --set port=8080
This also shows how trurl removes dot-dot sequencestrurl --url https://curl.se/we/are.html --get '{path}'
Extract the path from a URLtrurl --url https://curl.se/we/are.html --get '{default:port}'
This gets the default port based on the scheme if the port is not set in the URL.trurl --url https://curl.se/hello --append path=you
Append a path segment to a URLtrurl --url "https://curl.se?name=hello" --append query=search=string
Append a query segment to a URLcat urllist.txt | trurl --url-file -
Read URLs from stdintrurl "https://fake.host/search?q=answers&user=me#frag" --json
Output JSONtrurl "https://curl.se?search=hey&utm_source=tracker" --qtrim "utm_*"
Remove tracking tuples from querytrurl "https://example.com?a=home&here=now&thisthen" -g '{query:a}'
Show a specific query key valuetrurl "https://example.com?b=a&c=b&a=c" --sort-query
Sort the key/value pairs in the query componenttrurl "https://curl.se?search=fool;page=5" --qtrim "search" --query-separator ";"
Work with a query that uses a semicolon separatortrurl "https://curl.se/this has space/index.html" --accept-space
Accept spaces in the URL pathtrurl "https://curl.se/path/index.html" --iterate "scheme=http ftp sftp"
Create multiple variations of a URL with different schemes
Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.