rcl icon indicating copy to clipboard operation
rcl copied to clipboard

Exporting to env format

Open yonas opened this issue 1 year ago • 2 comments

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

yonas avatar Aug 06 '24 16:08 yonas

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

denfren avatar Aug 06 '24 19:08 denfren

@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:

  • automatically uppercase variable name: NAME=... instead of name=...
  • trim white space between variable name and value: NAME=... instead of NAME = ...
  • give visual cues about variable type: NAME="..." instead of NAME=... for String, and no quotes for Int or Bool

yonas avatar Aug 06 '24 20:08 yonas