From acf9a6a929bfd24d458b45520220d5b064440848 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 16 Sep 2024 14:05:05 +0200 Subject: [PATCH] trurl.md: provide examples to more option descriptions --- trurl.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/trurl.md b/trurl.md index dce38107..0a739a95 100644 --- a/trurl.md +++ b/trurl.md @@ -208,29 +208,54 @@ iteration. Several combined iterations are allowed to generate combinations, but only one *--iterate* option per component. The listed items to iterate over should be separated by single spaces. +Example: + + $ trurl example.com --iterate=scheme="ftp https" --iterate=port="22 80" + ftp://example.com:22/ + ftp://example.com:80/ + https://example.com:22/ + https://example.com:80/ + ## --json Outputs all set components of the URLs as JSON objects. All components of the URL that have data get populated in the parts object using their component names. See below for details on the format. +The URL components are provided URL decoded. Change that with **--urlencode**. + ## --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. This options, makes trurl not remove them. +Example: + + $ trurl https://example.com:443/ --keep-port + https://example.com:443/ + ## --no-guess-scheme Disables libcurl's scheme guessing feature. URLs that do not contain a scheme are treated as invalid URLs. +Example: + + $ trurl example.com --no-guess-scheme + trurl note: Bad scheme [example.com] + ## --punycode Uses the punycode version of the hostname, which is how International Domain Names are converted into plain ASCII. If the hostname is not using IDN, the regular ASCII name is used. +Example: + + $ trurl http://åäö/ --punycode + http://xn--4cab6c/ + ## --qtrim [what] Trims data off a query. @@ -250,6 +275,11 @@ used for this purpose. If your URL uses something other than the default letter, setting the right one makes sure trurl can do its query operations properly. +Example: + + $ trurl "https://curl.se?b=name:a=age" --sort-query --query-separator ":" + https://curl.se/?a=age:b=name + ## --quiet Suppress (some) notes and warnings. @@ -259,6 +289,11 @@ Suppress (some) notes and warnings. Redirect the URL to this new location. The redirection is performed on the base URL, so, if no base URL is specified, no redirection is performed. +Example: + + $ trurl --url https://curl.se/we/are.html --redirect ../here.html + https://curl.se/here.html + ## --replace [data] Replaces a URL query.