Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ feature request ] Export to env #64

Open
yonas opened this issue Aug 6, 2024 · 2 comments
Open

[ feature request ] Export to env #64

yonas opened this issue Aug 6, 2024 · 2 comments

Comments

@yonas
Copy link

yonas commented Aug 6, 2024

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
Copy link
Contributor

denfren commented Aug 6, 2024

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
Copy link
Author

yonas commented Aug 6, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants