Axel Fontaine
Axel Fontaine

Reputation: 35169

Best way to define optional setting keys in SBT

How should optional SettingKeys be handled in SBT?

Should I use SettingKey[Option[String]] or something else? And why?

Upvotes: 3

Views: 568

Answers (1)

0__
0__

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

Related Questions