I am used to use Scala scopt
for command line option parsing. You can choose whether an argument is .required()
by calling the just shown function.
How can I define an argument that is required only if another argument has been defined?
For instance, I have a flag --writeToSnowflake
defined via scopt like this:
opt[Unit]("writeToSnowflake")
.action((_, config) => config.copy(writeToSnowflake = true))
If I choose that a job writes to snowflake, a set of other arguments become mandatory. For instance, --snowflake_table
, --snowflake_database
, etc.
How can I achieve it?