Reputation: 35169
How should optional SettingKeys be handled in SBT?
Should I use SettingKey[Option[String]] or something else? And why?
Upvotes: 3
Views: 568
Reputation: 67280
If there is a sensible default value indicating "absence", you could use that. Otherwise, yes, use Option
, that's what it's for. A few standard keys in sbt use Option
(e.g. homepage
, publishTo
).
If your key uses a sequence, you can use the empty sequence to denote absence.
Upvotes: 2