[gmx-developers] Selection default options

Teemu Murtola teemu.murtola at gmail.com
Mon Aug 5 20:19:17 CEST 2013


Hi,

On Mon, Aug 5, 2013 at 7:06 PM, Anders Gärdenäs
<anders.gardenas at gmail.com>wrote:

> The problem is that I want "all" to be default options and I don’t know
> how to implement it.
>
> .defaultValue(all).   Won’t work (the input need to be of type
> gmx::selection); where running the program and type “–select all” will
> work.
>
> So in sort how do you use SelectionOption to select “all” by default?
>

This is not possible to achieve with the current implementation. But it
should be relatively straightforward to add such a mechanism (e.g., that
you can use .defaultSelectionText("all") for SelectionOption, and get that
string parsed behind the scenes if the user doesn't provide anything else).
Let me know if you want to implement such a thing and contribute it back;
I'm happy to review the change in gerrit. I can also do that at some point,
but don't expect immediate progress.

It will work somewhat differently from defaultValue(), though, since it is
not possible to construct the default gmx::Selection object at the time the
option is declared. So you can't immediately access the default selection,
like you can with "normal" values. And it may interact in surprising ways
with .required() (or its absence). I'd be happy to hear how you would
expect it to behave in the different cases (with or without required(), and
with only the option -select provided on the command line without any
value, which normally triggers an interactive prompt for that selection).

Best regards,
Teemu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20130805/0a090d04/attachment.html>


More information about the gromacs.org_gmx-developers mailing list