mirror of
https://github.com/wader/fq.git
synced 2024-12-25 22:34:14 +03:00
e3ae1440c9
Feels less cluttered, easier to read and more consistent. Still keep tovalue, tobytes etc that are more basic functions this only renamed format related functions. Also there is an exceptin for to/fromjson as it comes from jq. Also fixes lots of spelling errors while reading thru.
72 lines
1.3 KiB
Plaintext
72 lines
1.3 KiB
Plaintext
/probe.toml:
|
|
[test]
|
|
key = 123
|
|
$ fq . probe.toml
|
|
{
|
|
"test": {
|
|
"key": 123
|
|
}
|
|
}
|
|
# toml does not support null in arrays
|
|
# TODO: add uint64 norm test
|
|
$ fq -rRs 'fromjson[] | (walk(if type == "array" then map(select(. != null)) end) | try (to_toml | ., from_toml) catch .), "----"' variants.json
|
|
to_toml cannot be applied to: null
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
array = [true, false, 1.2, "string", [1.2, 3], {a = 1}]
|
|
"escape \\\"" = 456
|
|
false = false
|
|
number = 1.2
|
|
string = "string"
|
|
true = true
|
|
"white space" = 123
|
|
|
|
[object]
|
|
a = 1
|
|
|
|
{
|
|
"array": [
|
|
true,
|
|
false,
|
|
1.2,
|
|
"string",
|
|
[
|
|
1.2,
|
|
3
|
|
],
|
|
{
|
|
"a": 1
|
|
}
|
|
],
|
|
"escape \\\"": 456,
|
|
"false": false,
|
|
"number": 1.2,
|
|
"object": {
|
|
"a": 1
|
|
},
|
|
"string": "string",
|
|
"true": true,
|
|
"white space": 123
|
|
}
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
|
|
error at position 0x0: root object has no values
|
|
----
|
|
$ fq -n '"" | from_toml'
|
|
exitcode: 5
|
|
stderr:
|
|
error: error at position 0x0: root object has no values
|