-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
It would be nice to have environment variables act as default values.
I tried following:
option "key", :string, "-k", "--key",
default: ENV["MAPTILER_API_KEY"]?,
required: true,
desc: "Set the API key (also via MAPTILER_API_KEY env var)"But in https://github.com/TheMasterCado/easy-cli/blob/master/src/option/option.cr the @default is unconditionally set to nil because i marked it as required.
Now I can write it like this:
key = ENV["MAPTILER_API_KEY"]?
option "key", :string, "-k", "--key",
default: key,
required: key == nil,
desc: "Set the API key (also via MAPTILER_API_KEY env var)"But that just doesn't read quite as nice.
Metadata
Metadata
Assignees
Labels
No labels