corn-config / corn Goto Github PK
View Code? Open in Web Editor NEW๐ฝ A simple and pain-free configuration language. Reference libcorn implementation and CLI.
Home Page: https://cornlang.dev
License: MIT License
๐ฝ A simple and pain-free configuration language. Reference libcorn implementation and CLI.
Home Page: https://cornlang.dev
License: MIT License
Hi again @JakeStanger,
I couldn't find any mentions for a plan to adopt/not-to-adopt an advanced type system. Have you considered eventually to implement types? Seems like this could be a great feature and I bet you've already thought about this ;) This could be particularly useful for things like kubernetes-helm customizations, OpenAPI specs, bigger system-level configurations.
Would be great if you could share your plans or thoughts about a more advanced type system somewhere in the docs.
Thanks again for the cornlang, fantastic work!
The error code is a little messy at the moment, and the library makes heavy use of unwrap
. Error code should be refactored and the parser/deserializer should not panic anywhere.
Having an official 'playground' web tool capable of converting Corn into the standard 3 outputs could be very useful, and helps advertise it a bit.
Ideally it should support syntax highlighting for all the languages involved. I'm not sure on the logistics of that or the best tools to use yet.
Write plugin for VSCode to syntax highlight
Syntax support for multi-line strings should be added.
Something like:
foo = """
multi
line
string
"""
Support for input interpolation inside strings has made it impossible in some cases to include a $
in a string that does not belong to an input.
Write plugin for IntelliJ for syntax highlighting
The #[serde(untagged)]
attribute causes the TOML serializer to fail, but is required to produce valid JSON/YAML. TOML also does not support any kind of null
value so serde
fails to serialize None
values. At the moment this means TOML is not supported.
These are quite common but not currently supported by Corn. Syntax for quoting keys in 'single quotes'
should be added to allow this.
Example:
'foo.bar' = "baz" // does *not* expand to `foo = { bar = "baz" }`
Currently object merging only takes the immediate children into account.
There may be utility in changing this, or adding additional syntax, to perform a 'deep merge', running the merge against every child object.
Issue originates from the below discussion, which compares the feature to Nix's 'attrset merge':
Originally posted by fbewivpjsbsby November 6, 2023
It is like nixos module, config will merge when you imports config, use //
operators or use mkMerge.
Corn is override attrsets now.
let {
$preferences_user_enable = {
Value = true
Status = "user"
}
// telemetry
$policies_disable_telemetry = {
DisableTelemetry = true
DisableFirefoxStudies = true
}
// #TODO 'raw data' need git version corn
// theme
$policies_theme = {
Preferences = {
'toolkit.legacyUserProfileCustomizations.stylesheets' = $preferences_user_enable
'layout.css.backdrop-filter.enabled' = $preferences_user_enable
'widget.non-native-theme.use-theme-accent' = $preferences_user_enable
}
}
$policies_ech = {
// ech need enable DNS over HTTPS
DNSOverHTTPS = {
Enabled = true
ProviderURL = "https://1.1.1.1/dns-query"
Locked = false
ExcludedDomains = [""]
}
Preferences = {
'network.dns.echconfig.enabled' = $preferences_user_enable
'network.dns.http3_echconfig.enabled' = $preferences_user_enable
}
}
} in
{
policies = {
// telemetry
..$policies_disable_telemetry
// ech
..$policies_ech
// theme
..$policies_theme
}
}
corn [your corn file name].corn -t json
It is override by $policies_theme:{
"policies": {
"DisableTelemetry": true,
"DisableFirefoxStudies": true,
"DNSOverHTTPS": {
"Enabled": true,
"ProviderURL": "https://1.1.1.1/dns-query",
"Locked": false,
"ExcludedDomains": [
""
]
},
"Preferences": {
"toolkit.legacyUserProfileCustomizations.stylesheets": {
"Value": true,
"Status": "user"
},
"layout.css.backdrop-filter.enabled": {
"Value": true,
"Status": "user"
},
"widget.non-native-theme.use-theme-accent": {
"Value": true,
"Status": "user"
}
}
}
}
Currently cornfig::parse
returns the a tree of parsed values which isn't super useful for library use. A serde::Deserializer
implementation should be written to attempt to deserialize into structs.
It's possible to serialize the Corn output using serde then deserialize it again, but this comes with a lot of overhead and requires shipping another format library.
Lots of things need more than alphanumeric strings in keys. Hyphens would be especially useful. Full unicode should maybe be allowed if keys are quoted.
This is currently limiting Corn's use in ironbar.
There should be an LSP uh, thing, to provide full support to VSCode, Vim and all the rest.
Moving to workspace with readme in top level now means crates don't have readme info.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.