nickel
nickel copied to clipboard
Add `--format` argument to `nickel query` command
Closes #1976
This PR adds the ability for nickel query
to export the result to JSON, YAML & TOML, similar to that of nickel export
. The output schema looks like:
{
doc | Nullable String,
"optional" | Bool,
not_exported | Bool,
priority | String, # variants include: "default", "neutral", "force", and string representation of rational number ("1", "5/2", etc.)
type | Nullable String,
contracts | Array String,
sub_fields | Nullable (Array String),
value | String | optional,
}
During implementation, I found a few areas that ask for "designing":
- whether to use
Nullable T
orT | optional
for some fields in the output schema - how to serialize the priority field
- the logic that dictates the presence of the value field