ruuda / rcl

A reasonable configuration language
https://rcl-lang.org
Apache License 2.0
189 stars 8 forks source link

[ feature request ] Export to env #64

Open yonas opened 1 month ago

yonas commented 1 month ago

It would be nice to create a Record and have the output be type specific. Eg.

type Person = {
  name: String,
  age: Int,
};

let john: Person = {
  name: "John Doe",
  age: 99,
};

output:

NAME="John Doe"
AGE=99
denfren commented 1 month ago

AFAIK, environment variables are always text. I'd expect the following output to be equivalent

NAME=John Doe
AGE="99"

Where are you passing the output to and do you actually get errors with my output?


side note: your snippet is missing the type annotation (Person)

let john: Person = { ...

maybe an "unused type" warning would be a good thing

yonas commented 1 month ago

@denfren I'm passing the output to Taskfile . Your example doesn't cause any errors.

I'm looking for the formatting. The .env formatting would make sure to: