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": { object or null
<query-key>: [ array or null <query-key>: [ array or null
string <query-value> string # [0]
] ]
}, },
"query_list": [ array or null "query_list": [ array or null
string [
<query-key> string, # [1]
<query-value> string
]
], ],
"fragment": string or null, "fragment": string or null,
"username": string or null, "username": string or null,
@ -42,17 +45,48 @@ Schema:
"port": integer or null "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: 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", "scheme": "http",
"netloc": "example.com", "netloc": "example.com",
"path": "/test/path", "path": "/test/path",
"path_list": [
"test",
"path"
],
"query": { "query": {
"q1": "foo", "q1": [
"q2": "bar" "foo",
"bar"
],
"q2": [
"baz"
]
}, },
"query_list": [
[
"q1",
"foo"
],
[
"q1",
"bar"
],
[
"q2",
"baz"
]
],
"fragment": "frag", "fragment": "frag",
"username": null, "username": null,
"password": null, "password": null,
@ -62,11 +96,16 @@ Examples:
$ echo "ftp://localhost/filepath" | jc --url -p $ echo "ftp://localhost/filepath" | jc --url -p
{ {
"quoted": "ftp://localhost/filepath",
"unquoted": "ftp://localhost/filepath",
"scheme": "ftp", "scheme": "ftp",
"netloc": "localhost", "netloc": "localhost",
"path": "/filepath", "path": "/filepath",
"path_list": ['filepath'], "path_list": [
"filepath"
],
"query": null, "query": null,
"query_list": null,
"fragment": null, "fragment": null,
"username": null, "username": null,
"password": null, "password": null,