reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobin Baker <>
Subject using NamedParameter to implement a no-arg boolean command-line option
Date Thu, 03 Dec 2015 21:08:00 GMT
Hi, I'm trying to use CommandLine.parseToConfiguration() to implement an
implicit boolean command-line option, where the boolean value is understood
to be true if the option is present, and false otherwise. I.e., I want
something that looks like this:

java -cp '/Users/tdbaker/myria/build/libs/*'
edu.washington.escience.myria.daemon.MyriaDriverLauncher -yarn

where I can set a boolean variable useYarn based on whether -yarn is
present or not. Obviously I could just do

java -cp '/Users/tdbaker/myria/build/libs/*'
edu.washington.escience.myria.daemon.MyriaDriverLauncher -yarn true

using Name<Boolean> and getNamedInstance(), but I'd rather not for
ergonomics' sake.

I can't seem to find the right combination of Name<Boolean>, Name<Void>,
default_value, or isParameterSet() to achieve this behavior, and I can't
find examples that implement this command-line behavior either. Any



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message