1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

fixup schema and examples

This commit is contained in:
Kelly Brazil
2022-07-20 16:31:59 -07:00
parent 641d63604b
commit 2eaef09770

View File

@ -29,11 +29,14 @@ Schema:
],
"query": { object or null
<query-key>: [ array or null
string
<query-value> string # [0]
]
},
"query_list": [ array or null
string
[
<query-key> string, # [1]
<query-value> string
]
],
"fragment": string or null,
"username": string or null,
@ -42,17 +45,48 @@ Schema:
"port": integer or null
}
[0] Duplicate query-keys will have their values consolidated into the
array of query-values
[1] The first array value is the query-key and the second value is the
query-value
Examples:
$ echo "http://example.com/test/path?q1=foo&q2=bar#frag" | jc --url -p
% echo "http://example.com/test/path?q1=foo&q1=bar&q2=baz#frag" \\
| jc --url -p
{
"quoted": "http://example.com/test/path?q1%3Dfoo%26q1%3Dbar%26q2%3Dbaz#frag",
"unquoted": "http://example.com/test/path?q1=foo&q1=bar&q2=baz#frag",
"scheme": "http",
"netloc": "example.com",
"path": "/test/path",
"path_list": [
"test",
"path"
],
"query": {
"q1": "foo",
"q2": "bar"
"q1": [
"foo",
"bar"
],
"q2": [
"baz"
]
},
"query_list": [
[
"q1",
"foo"
],
[
"q1",
"bar"
],
[
"q2",
"baz"
]
],
"fragment": "frag",
"username": null,
"password": null,
@ -62,11 +96,16 @@ Examples:
$ echo "ftp://localhost/filepath" | jc --url -p
{
"quoted": "ftp://localhost/filepath",
"unquoted": "ftp://localhost/filepath",
"scheme": "ftp",
"netloc": "localhost",
"path": "/filepath",
"path_list": ['filepath'],
"path_list": [
"filepath"
],
"query": null,
"query_list": null,
"fragment": null,
"username": null,
"password": null,