Initial commit
This commit is contained in:
commit
dd939ae1f6
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -0,0 +1,438 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_ci"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
|
||||
[[package]]
|
||||
name = "json2kdl"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kdl",
|
||||
"miette",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kdl"
|
||||
version = "4.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "062c875482ccb676fd40c804a40e3824d4464c18c364547456d1c8e8e951ae47"
|
||||
dependencies = [
|
||||
"miette",
|
||||
"nom",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
|
||||
[[package]]
|
||||
name = "miette"
|
||||
version = "5.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4afd9b301defa984bbdbe112b4763e093ed191750a0d914a78c1106b2d0fe703"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"backtrace",
|
||||
"miette-derive",
|
||||
"once_cell",
|
||||
"owo-colors",
|
||||
"supports-color",
|
||||
"supports-hyperlinks",
|
||||
"supports-unicode",
|
||||
"terminal_size",
|
||||
"textwrap",
|
||||
"thiserror",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miette-derive"
|
||||
version = "5.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97c2401ab7ac5282ca5c8b518a87635b1a93762b0b90b9990c509888eeccba29"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.30.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.152"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smawk"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
|
||||
|
||||
[[package]]
|
||||
name = "supports-color"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"is_ci",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "supports-hyperlinks"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406"
|
||||
dependencies = [
|
||||
"atty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "supports-unicode"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2"
|
||||
dependencies = [
|
||||
"atty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.1.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d"
|
||||
dependencies = [
|
||||
"smawk",
|
||||
"unicode-linebreak",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "775c11906edafc97bc378816b94585fbd9a054eabaf86fdd0ced94af449efab7"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-linebreak"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "json2kdl"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Agatha V. Lovelace <agatha@technogothic.net>"]
|
||||
description = "A tool that converts JSON files to KDL"
|
||||
license = "NVPLv7+"
|
||||
|
||||
[dependencies]
|
||||
kdl = "4.6.0"
|
||||
miette = { version = "5.5.0", features = ["fancy"] }
|
||||
serde_json = "1.0.94"
|
|
@ -0,0 +1,431 @@
|
|||
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
|
||||
COOPERATIVE NON-VIOLENT PUBLIC LICENSE (\"LICENSE\"). THE WORK IS
|
||||
PROTECTED BY COPYRIGHT AND ALL OTHER APPLICABLE LAWS. ANY USE OF THE
|
||||
WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
|
||||
PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED IN THIS
|
||||
LICENSE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE
|
||||
EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR
|
||||
GRANTS YOU THE RIGHTS CONTAINED HERE IN AS CONSIDERATION FOR ACCEPTING
|
||||
THE TERMS AND CONDITIONS OF THIS LICENSE AND FOR AGREEING TO BE BOUND BY
|
||||
THE TERMS AND CONDITIONS OF THIS LICENSE.
|
||||
|
||||
# Definitions
|
||||
|
||||
An Act of War is any action of one country against any group either with
|
||||
an intention to provoke a conflict or an action that occurs during a
|
||||
declared war or during armed conflict between military forces of any
|
||||
origin. This includes but is not limited to enforcing sanctions or
|
||||
sieges, supplying armed forces, or profiting from the manufacture of
|
||||
tools or weaponry used in military conflict.
|
||||
|
||||
An Adaptation is a work based upon the Work, or upon the Work and other
|
||||
pre-existing works, such as a translation, adaptation, derivative work,
|
||||
arrangement of music or other alterations of a literary or artistic
|
||||
work, or phonogram or performance and includes cinematographic
|
||||
adaptations or any other form in which the Work may be recast,
|
||||
transformed, or adapted including in any form recognizably derived from
|
||||
the original, except that a work that constitutes a Collection will not
|
||||
be considered an Adaptation for the purpose of this License. For the
|
||||
avoidance of doubt, where the Work is a musical work, performance or
|
||||
phonogram, the synchronization of the Work in timed-relation with a
|
||||
moving image (\"synching\") will be considered an Adaptation for the
|
||||
purpose of this License. In addition, where the Work is designed to
|
||||
output a neural network the output of the neural network will be
|
||||
considered an Adaptation for the purpose of this license.
|
||||
|
||||
Bodily Harm is any physical hurt or injury to a person that interferes
|
||||
with the health or comfort of the person and that is more than merely
|
||||
transient or trifling in nature.
|
||||
|
||||
Distribute is to make available to the public the original and copies of
|
||||
the Work or Adaptation, as appropriate, through sale, gift or any other
|
||||
transfer of possession or ownership.
|
||||
|
||||
Incarceration is Confinement in a jail, prison, or any other place where
|
||||
individuals of any kind are held against either their will or (if their
|
||||
will cannot be determined) the will of their legal guardian or
|
||||
guardians. In the case of a conflict between the will of the individual
|
||||
and the will of their legal guardian or guardians, the will of the
|
||||
individual will take precedence.
|
||||
|
||||
Licensor is The individual, individuals, entity, or entities that
|
||||
offer(s) the Work under the terms of this License
|
||||
|
||||
Original Author is in the case of a literary or artistic work, the
|
||||
individual, individuals, entity or entities who created the Work or if
|
||||
no individual or entity can be identified, the publisher; and in
|
||||
addition
|
||||
|
||||
- in the case of a performance the actors, singers, musicians,
|
||||
dancers, and other persons who act, sing, deliver, declaim, play in,
|
||||
interpret or otherwise perform literary or artistic works or
|
||||
expressions of folklore;
|
||||
|
||||
- in the case of a phonogram the producer being the person or legal
|
||||
entity who first fixes the sounds of a performance or other sounds;
|
||||
and,
|
||||
|
||||
- in the case of broadcasts, the organization that transmits the
|
||||
broadcast.
|
||||
|
||||
Work is the literary and/or artistic work offered under the terms of
|
||||
this License including without limitation any production in the
|
||||
literary, scientific and artistic domain, whatever may be the mode or
|
||||
form of its expression including digital form, such as a book, pamphlet
|
||||
and other writing; a lecture, address, sermon or other work of the same
|
||||
nature; a dramatic or dramatico-musical work; a choreographic work or
|
||||
entertainment in dumb show; a musical composition with or without words;
|
||||
a cinematographic work to which are assimilated works expressed by a
|
||||
process analogous to cinematography; a work of drawing, painting,
|
||||
architecture, sculpture, engraving or lithography; a photographic work
|
||||
to which are assimilated works expressed by a process analogous to
|
||||
photography; a work of applied art; an illustration, map, plan, sketch
|
||||
or three-dimensional work relative to geography, topography,
|
||||
architecture or science; a performance; a broadcast; a phonogram; a
|
||||
compilation of data to the extent it is protected as a copyrightable
|
||||
work; or a work performed by a variety or circus performer to the extent
|
||||
it is not otherwise considered a literary or artistic work.
|
||||
|
||||
You means an individual or entity exercising rights under this License
|
||||
who has not previously violated the terms of this License with respect
|
||||
to the Work, or who has received express permission from the Licensor to
|
||||
exercise rights under this License despite a previous violation.
|
||||
|
||||
Publicly Perform means to perform public recitations of the Work and to
|
||||
communicate to the public those public recitations, by any means or
|
||||
process, including by wire or wireless means or public digital
|
||||
performances; to make available to the public Works in such a way that
|
||||
members of the public may access these Works from a place and at a place
|
||||
individually chosen by them; to perform the Work to the public by any
|
||||
means or process and the communication to the public of the performances
|
||||
of the Work, including by public digital performance; to broadcast and
|
||||
rebroadcast the Work by any means including signs, sounds or images.
|
||||
|
||||
Reproduce is to make copies of the Work by any means including without
|
||||
limitation by sound or visual recordings and the right of fixation and
|
||||
reproducing fixations of the Work, including storage of a protected
|
||||
performance or phonogram in digital form or other electronic medium.
|
||||
|
||||
Software is any digital Work which, through use of a third-party piece
|
||||
of Software or through the direct usage of itself on a computer system,
|
||||
the memory of the computer is modified dynamically or semi-dynamically.
|
||||
\"Software\", secondly, processes or interprets information.
|
||||
|
||||
Source Code is Any digital Work which, through use of a third-party
|
||||
piece of Software or through the direct usage of itself on a computer
|
||||
system, the memory of the computer is modified dynamically or
|
||||
semi-dynamically. \"Software\", secondly, processes or interprets
|
||||
information.
|
||||
|
||||
Surveilling is the use of the Work to either overtly or covertly observe
|
||||
and record persons and or their activities.
|
||||
|
||||
A Network Service is the use of a piece of Software to interpret or
|
||||
modify information that is subsequently and directly served to users
|
||||
over the Internet.
|
||||
|
||||
To Discriminate is use of a work to differentiate between humans in a
|
||||
such a way which prioritizes some above others on the basis of percieved
|
||||
membership within certain groups.
|
||||
|
||||
Hate Speech is Communication or any form of expression which is solely
|
||||
for the purpose of expressing hatred for some group or advocating a form
|
||||
of Discrimination between humans.
|
||||
|
||||
Coercion is leveraging of the threat of force or use of force to
|
||||
intimidate a person in order to gain compliance, or to offer large
|
||||
incentives which aim to entice a person to act against their will.
|
||||
|
||||
# Fair Dealing Rights
|
||||
|
||||
Nothing in this License is intended to reduce, limit, or restrict any
|
||||
uses free from copyright or rights arising from limitations or
|
||||
exceptions that are provided for in connection with the copyright
|
||||
protection under copyright law or other applicable laws.
|
||||
|
||||
# License Grant
|
||||
|
||||
Subject to the terms and conditions of this License, Licensor hereby
|
||||
grants You a worldwide, royalty-free, non-exclusive, perpetual (for the
|
||||
duration of the applicable copyright) license to exercise the rights in
|
||||
the Work as stated below:
|
||||
|
||||
To Reproduce the Work, to incorporate the Work into one or more
|
||||
Collections, and to Reproduce the Work as incorporated in the
|
||||
Collections
|
||||
|
||||
To create and Reproduce Adaptations provided that any such Adaptation,
|
||||
including any translation in any medium, takes reasonable steps to
|
||||
clearly label, demarcate or otherwise identify that changes were made to
|
||||
the original Work. For example, a translation could be marked \"The
|
||||
original work was translated from English to Spanish,\" or a
|
||||
modification could indicate \"The original work has been modified.\"
|
||||
|
||||
To Distribute and Publicly Perform the Work including as incorporated in
|
||||
Collections.
|
||||
|
||||
To Distribute and Publicly Perform Adaptations. The above rights may be
|
||||
exercised in all media and formats whether now known or hereafter
|
||||
devised. The above rights include the right to make such modifications
|
||||
as are technically necessary to exercise the rights in other media and
|
||||
formats. This License constitutes the entire agreement between the
|
||||
parties with respect to the Work licensed here. There are no
|
||||
understandings, agreements or representations with respect to the Work
|
||||
not specified here. Licensor shall not be bound by any additional
|
||||
provisions that may appear in any communication from You. This License
|
||||
may not be modified without the mutual written agreement of the Licensor
|
||||
and You. All rights not expressly granted by Licensor are hereby
|
||||
reserved, including but not limited to the rights set forth in
|
||||
Non-waivable Compulsory License Schemes, Waivable Compulsory License
|
||||
Schemes, and Voluntary License Schemes in the restrictions.
|
||||
|
||||
# Restrictions
|
||||
|
||||
The license granted in the license grant above is expressly made subject
|
||||
to and limited by the following restrictions:
|
||||
|
||||
You may Distribute or Publicly Perform the Work only under the terms of
|
||||
this License. You must include a copy of, or the Uniform Resource
|
||||
Identifier (URI) for, this License with every copy of the Work You
|
||||
Distribute or Publicly Perform. You may not offer or impose any terms on
|
||||
the Work that restrict the terms of this License or the ability of the
|
||||
recipient of the Work to exercise the rights granted to that recipient
|
||||
under the terms of the License. You may not sublicense the Work. You
|
||||
must keep intact all notices that refer to this License and to the
|
||||
disclaimer of warranties with every copy of the Work You Distribute or
|
||||
Publicly Perform. When You Distribute or Publicly Perform the Work, You
|
||||
may not impose any effective technological measures on the Work that
|
||||
restrict the ability of a recipient of the Work from You to exercise the
|
||||
rights granted to that recipient under the terms of the License. This
|
||||
Section applies to the Work as incorporated in a Collection, but this
|
||||
does not require the Collection apart from the Work itself to be made
|
||||
subject to the terms of this License. If You create a Collection, upon
|
||||
notice from any Licensor You must, to the extent practicable, remove
|
||||
from the Collection any credit as requested. If You create an
|
||||
Adaptation, upon notice from any Licensor You must, to the extent
|
||||
practicable, remove from the Adaptation any credit as requested.
|
||||
|
||||
If the Work meets the definition of Software, You may exercise the
|
||||
rights granted in the license grant only if You provide a copy of the
|
||||
corresponding Source Code from which the Work was derived in digital
|
||||
form, or You provide a URI for the corresponding Source Code of the
|
||||
Work, to any recipients upon request.
|
||||
|
||||
If the Work is used as or for a Network Service, You may exercise the
|
||||
rights granted in the license grant only if You provide a copy of the
|
||||
corresponding Source Code from which the Work was derived in digital
|
||||
form, or You provide a URI for the corresponding Source Code to the
|
||||
Work, to any recipients of the data served or modified by the Web
|
||||
Service.
|
||||
|
||||
##
|
||||
|
||||
You may exercise the rights granted in the license grant for any
|
||||
purposes only if:
|
||||
|
||||
i. You do not use the Work for the purpose of inflicting Bodily Harm on
|
||||
human beings (subject to criminal prosecution or otherwise) outside
|
||||
of providing medical aid or undergoing a voluntary procedure under
|
||||
no form of Coercion.
|
||||
|
||||
ii. You do not use the Work for the purpose of Surveilling or tracking
|
||||
individuals for financial gain.
|
||||
|
||||
iii. You do not use the Work in an Act of War.
|
||||
|
||||
iv. You do not use the Work for the purpose of supporting or profiting
|
||||
from an Act of War.
|
||||
|
||||
v. You do not use the Work for the purpose of Incarceration.
|
||||
|
||||
vi. You do not use the Work for the purpose of extracting, processing,
|
||||
or refining, oil, gas, or coal. Or to in any other way to
|
||||
deliberately pollute the environment as a byproduct of manufacturing
|
||||
or irresponsible disposal of hazardous materials.
|
||||
|
||||
vii. You do not use the Work for the purpose of expediting,
|
||||
coordinating, or facilitating paid work undertaken by individuals
|
||||
under the age of 12 years.
|
||||
|
||||
viii. You do not use the Work to either Discriminate or spread Hate
|
||||
Speech on the basis of sex, sexual orientation, gender identity,
|
||||
race, age, disability, color, national origin, religion, caste, or
|
||||
lower economic status.
|
||||
|
||||
##
|
||||
|
||||
If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||
Collections, You must, unless a request has been made by any Licensor to
|
||||
remove credit from a Collection or Adaptation, keep intact all copyright
|
||||
notices for the Work and provide, reasonable to the medium or means You
|
||||
are utilizing:
|
||||
|
||||
i. the name of the Original Author (or pseudonym, if applicable) if
|
||||
supplied, and/or if the Original Author and/or Licensor designate
|
||||
another party or parties (e.g., a sponsor institute, publishing
|
||||
entity, journal) for attribution (\"Attribution Parties\") in
|
||||
Licensor\'s copyright notice, terms of service or by other
|
||||
reasonable means, the name of such party or parties;
|
||||
|
||||
ii. the title of the Work if supplied;
|
||||
|
||||
iii. to the extent reasonably practicable, the URI, if any, that
|
||||
Licensor to be associated with the Work, unless such URI does not
|
||||
refer to the copyright notice or licensing information for the
|
||||
Work; and,
|
||||
|
||||
iv. in the case of an Adaptation, a credit identifying the use of the
|
||||
Work in the Adaptation (e.g., \"French translation of the Work by
|
||||
Original Author,\" or \"Screenplay based on original Work by
|
||||
Original Author\").
|
||||
|
||||
If any Licensor has sent notice to request removing credit, You must, to
|
||||
the extent practicable, remove any credit as requested. The credit
|
||||
required by this Section may be implemented in any reasonable manner;
|
||||
provided, however, that in the case of an Adaptation or Collection, at a
|
||||
minimum such credit will appear, if a credit for all contributing
|
||||
authors of the Adaptation or Collection appears, then as part of these
|
||||
credits and in a manner at least as prominent as the credits for the
|
||||
other contributing authors. For the avoidance of doubt, You may only use
|
||||
the credit required by this Section for the purpose of attribution in
|
||||
the manner set out above and, by exercising Your rights under this
|
||||
License, You may not implicitly or explicitly assert or imply any
|
||||
connection with, sponsorship or endorsement by the Original Author,
|
||||
Licensor and/or Attribution Parties, as appropriate, of You or Your use
|
||||
of the Work, without the separate, express prior written permission of
|
||||
the Original Author, Licensor and/or Attribution Parties.
|
||||
|
||||
Except as otherwise agreed in writing by the Licensor or as may be
|
||||
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||
Publicly Perform the Work either by itself or as part of any Adaptations
|
||||
or Collections, You must not distort, mutilate, modify or take other
|
||||
derogatory action in relation to the Work which would be prejudicial to
|
||||
the Original Author\'s honor or reputation. Licensor agrees that in
|
||||
those jurisdictions (e.g. Japan), in which any exercise of the right
|
||||
granted in the license grant of this License (the right to make
|
||||
Adaptations) would be deemed to be a distortion, mutilation,
|
||||
modification or other derogatory action prejudicial to the Original
|
||||
Author\'s honor and reputation, the Licensor will waive or not assert,
|
||||
as appropriate, this Section, to the fullest extent permitted by the
|
||||
applicable national law, to enable You to reasonably exercise Your right
|
||||
under the license grant of this License (right to make Adaptations) but
|
||||
not otherwise.
|
||||
|
||||
Do not make any legal claim against anyone accusing the Work, with or
|
||||
without changes, alone or with other works, of infringing any patent
|
||||
claim.
|
||||
|
||||
# Representations Warranties and Disclaimer
|
||||
|
||||
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||
EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||
|
||||
# Limitation on Liability
|
||||
|
||||
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
|
||||
LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF
|
||||
THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
# Termination
|
||||
|
||||
This License and the rights granted hereunder will terminate
|
||||
automatically upon any breach by You of the terms of this License.
|
||||
Individuals or entities who have received Adaptations or Collections
|
||||
from You under this License, however, will not have their licenses
|
||||
terminated provided such individuals or entities remain in full
|
||||
compliance with those licenses. The Sections on definitions, fair
|
||||
dealing rights, representations, warranties, and disclaimer, limitation
|
||||
on liability, termination, and revised license versions will survive any
|
||||
termination of this License.
|
||||
|
||||
Subject to the above terms and conditions, the license granted here is
|
||||
perpetual (for the duration of the applicable copyright in the Work).
|
||||
Notwithstanding the above, Licensor reserves the right to release the
|
||||
Work under different license terms or to stop distributing the Work at
|
||||
any time; provided, however that any such election will not serve to
|
||||
withdraw this License (or any other license that has been, or is
|
||||
required to be, granted under the terms of this License), and this
|
||||
License will continue in full force and effect unless terminated as
|
||||
stated above.
|
||||
|
||||
# Revised License Versions
|
||||
|
||||
This License may receive future revisions in the original spirit of the
|
||||
license intended to strengthen This License. Each version of This
|
||||
License has an incrementing version number.
|
||||
|
||||
Unless otherwise specified like in the below subsection The Licensor has
|
||||
only granted this current version of This License for The Work. In this
|
||||
case future revisions do not apply.
|
||||
|
||||
The Licensor may specify that the latest available revision of This
|
||||
License be used for The Work by either explicitly writing so or by
|
||||
suffixing the License URI with a \"+\" symbol.
|
||||
|
||||
The Licensor may specify that The Work is also available under the terms
|
||||
of This License\'s current revision as well as specific future
|
||||
revisions. The Licensor may do this by writing it explicitly or
|
||||
suffixing the License URI with any additional version numbers each
|
||||
separated by a comma.
|
||||
|
||||
# Miscellaneous
|
||||
|
||||
Each time You Distribute or Publicly Perform the Work or a Collection,
|
||||
the Licensor offers to the recipient a license to the Work on the same
|
||||
terms and conditions as the license granted to You under this License.
|
||||
|
||||
Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||
offers to the recipient a license to the original Work on the same terms
|
||||
and conditions as the license granted to You under this License.
|
||||
|
||||
If the Work is classified as Software, each time You Distribute or
|
||||
Publicly Perform an Adaptation, Licensor offers to the recipient a copy
|
||||
and/or URI of the corresponding Source Code on the same terms and
|
||||
conditions as the license granted to You under this License.
|
||||
|
||||
If the Work is used as a Network Service, each time You Distribute or
|
||||
Publicly Perform an Adaptation, or serve data derived from the Software,
|
||||
the Licensor offers to any recipients of the data a copy and/or URI of
|
||||
the corresponding Source Code on the same terms and conditions as the
|
||||
license granted to You under this License.
|
||||
|
||||
If any provision of this License is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this License, and without further action
|
||||
by the parties to this agreement, such provision shall be reformed to
|
||||
the minimum extent necessary to make such provision valid and
|
||||
enforceable.
|
||||
|
||||
No term or provision of this License shall be deemed waived and no
|
||||
breach consented to unless such waiver or consent shall be in writing
|
||||
and signed by the party to be charged with such waiver or consent.
|
||||
|
||||
This License constitutes the entire agreement between the parties with
|
||||
respect to the Work licensed here. There are no understandings,
|
||||
agreements or representations with respect to the Work not specified
|
||||
here. Licensor shall not be bound by any additional provisions that may
|
||||
appear in any communication from You. This License may not be modified
|
||||
without the mutual written agreement of the Licensor and You.
|
||||
|
||||
The rights granted under, and the subject matter referenced, in this
|
||||
License were drafted utilizing the terminology of the Berne Convention
|
||||
for the Protection of Literary and Artistic Works (as amended on
|
||||
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and
|
||||
the Universal Copyright Convention (as revised on July 24, 1971). These
|
||||
rights and subject matter take effect in the relevant jurisdiction in
|
||||
which the License terms are sought to be enforced according to the
|
||||
corresponding provisions of the implementation of those treaty
|
||||
provisions in the applicable national law. If the standard suite of
|
||||
rights granted under applicable copyright law includes additional rights
|
||||
not granted under this License, such additional rights are deemed to be
|
||||
included in the License; this License is not intended to restrict the
|
||||
license of any rights under applicable law.
|
|
@ -0,0 +1,22 @@
|
|||
# json2kdl
|
||||
|
||||
json2kdl is a program that generates KDL files from JSON
|
||||
|
||||
![A terminal screenshot of me running cat to show the contents of an example json file, then running json2kdl on it and showing the kdl output in a new file](https://eldritchcafe.files.fedi.monster/media_attachments/files/109/972/564/372/013/139/original/ab2e73d17967d369.png)
|
||||
|
||||
## Intended Use
|
||||
|
||||
json2kdl was made specifically for [Nixpkgs Issue #198655](https://github.com/NixOS/nixpkgs/issues/198655),
|
||||
which means, these features are currently out of scope:
|
||||
- Parsing arbitrary JSON
|
||||
Currently, the input file structure must follow a specific schema:
|
||||
- [Nodes](https://github.com/kdl-org/kdl/blob/main/SPEC.md#node) can be defined as fields of the root JSON object (`{}`)
|
||||
- Each node can have these optional fields:
|
||||
- `arguments` (Array of [Values](https://github.com/kdl-org/kdl/blob/main/SPEC.md#value))
|
||||
- `properties` (Object with [Identifier](https://github.com/kdl-org/kdl/blob/main/SPEC.md#identifier):[Value](https://github.com/kdl-org/kdl/blob/main/SPEC.md#value) pairs)
|
||||
- `children` (Object with fields representing [Nodes](https://github.com/kdl-org/kdl/blob/main/SPEC.md#node))
|
||||
|
||||
See `examples/example.json`
|
||||
- Comments (As JSON does not support them)
|
||||
- Type Annotations
|
||||
- Types that KDL has but JSON does not and vice versa
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"thermal-paste": {
|
||||
"arguments": [
|
||||
"NT-H1"
|
||||
],
|
||||
"children": {
|
||||
"description": {
|
||||
"arguments": [
|
||||
"it tastes nice:)"
|
||||
]
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"amount": "3.5g"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
use kdl::{KdlDocument, KdlEntry, KdlNode, KdlValue, NodeKey};
|
||||
use miette::{miette, IntoDiagnostic, Result};
|
||||
use serde_json::Value;
|
||||
use std::{env, fs};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
// Get paths for input and output files from first 2 passed arguments
|
||||
let input = env::args()
|
||||
.nth(1)
|
||||
.ok_or_else(|| miette!("Please provide an input JSON file path"))?;
|
||||
|
||||
let output = env::args()
|
||||
.nth(2)
|
||||
.ok_or_else(|| miette!("Please provide an output KDL file path"))?;
|
||||
|
||||
// Read input file to string
|
||||
let input = fs::read_to_string(&input)
|
||||
.into_diagnostic()
|
||||
.map_err(|err| err.context(format!("Could not read file `{input}`")))?;
|
||||
|
||||
// Parse input file into JSON
|
||||
let input: Value = serde_json::from_str(&input).into_diagnostic()?;
|
||||
|
||||
// Parse JSON to KDL and write to output file
|
||||
fs::write(output, json_to_kdl(input)?.to_string()).into_diagnostic()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn json_to_kdl(json: Value) -> Result<KdlDocument> {
|
||||
let nodes: Vec<Result<KdlNode>> = json
|
||||
.as_object()
|
||||
.ok_or_else(|| miette!("Document root must be a JSON object"))?
|
||||
.iter()
|
||||
.map(|(key, value)| {
|
||||
let mut node = KdlNode::new(key.as_str());
|
||||
|
||||
if let Some(arguments) = value.get("arguments") {
|
||||
let args: Vec<KdlValue> = arguments
|
||||
.as_array()
|
||||
.ok_or_else(|| miette!("`arguments` must be an Array"))?
|
||||
.iter()
|
||||
.filter_map(|v| value_to_kdl(v.to_owned()).ok())
|
||||
.collect();
|
||||
|
||||
for arg in args {
|
||||
node.push(KdlEntry::new(arg));
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(properties) = value.get("properties") {
|
||||
let properties: Vec<(NodeKey, KdlEntry)> = properties
|
||||
.as_object()
|
||||
.ok_or_else(|| miette!("`properties` must be an Object"))?
|
||||
.iter()
|
||||
.filter_map(|(key, value)| match value_to_kdl(value.to_owned()) {
|
||||
Ok(val) => Some((key.to_owned().into(), KdlEntry::new(val))),
|
||||
Err(_) => None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
for (key, value) in properties {
|
||||
node.insert(key, value);
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(children) = value.get("children") {
|
||||
node.set_children(json_to_kdl(children.to_owned())?);
|
||||
};
|
||||
|
||||
Ok(node)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut document = KdlDocument::new();
|
||||
|
||||
for node in nodes {
|
||||
document.nodes_mut().push(node?);
|
||||
}
|
||||
|
||||
Ok(document)
|
||||
}
|
||||
|
||||
/// Try converting a JSON Value into a KDL Value
|
||||
fn value_to_kdl(value: Value) -> Result<KdlValue> {
|
||||
match value {
|
||||
Value::Null => Ok(KdlValue::Null),
|
||||
Value::Bool(bool) => Ok(KdlValue::Bool(bool)),
|
||||
Value::Number(num) => {
|
||||
if num.is_f64() {
|
||||
Ok(KdlValue::Base10Float(num.as_f64().ok_or_else(|| {
|
||||
miette!("{num} cannot be parsed into a float")
|
||||
})?))
|
||||
} else {
|
||||
Ok(KdlValue::Base10(num.as_i64().ok_or_else(|| {
|
||||
miette!("{num} cannot be parsed into a number")
|
||||
})?))
|
||||
}
|
||||
}
|
||||
Value::String(string) => Ok(KdlValue::String(string)),
|
||||
_ => Err(miette!("Type cannot be represented as a KDL value")),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_conversion() -> Result<()> {
|
||||
let input = serde_json::json!(
|
||||
{
|
||||
"bees": {
|
||||
"arguments": [
|
||||
true,
|
||||
42,
|
||||
3.1415,
|
||||
null,
|
||||
"how many eggs are you currently holding?"
|
||||
],
|
||||
"properties": {
|
||||
"how many": "uhhh like 40?",
|
||||
"state?": "quite upset"
|
||||
}
|
||||
},
|
||||
"lemon": {
|
||||
"children": {
|
||||
"child": {
|
||||
"properties": {
|
||||
"age": 3
|
||||
}
|
||||
},
|
||||
"child-eater": {
|
||||
"arguments": [
|
||||
":^)"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"ohno": {}
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
json_to_kdl(input)?.to_string(),
|
||||
"bees true 42 3.1415 null \"how many eggs are you currently holding?\" \"how many\"=\"uhhh like 40?\" state?=\"quite upset\"\nlemon {\n child age=3\n child-eater \":^)\"\n}\nohno\n"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue