Skip to content

How to detect when String option was specified without value #279

@pditommaso

Description

@pditommaso

I'm wondering if picocli allows the support for implicit value parameter having an arity of 0..1 and not value is specified.

To make it clear consider the following definition:

@Command(name='sample')
class Sample {
  @Option(names="--foo", aritiy="0..1")
  String foo
}

Now, the use case requires that when the user specifies the --foo parameter w/o a value an implicit value is assigned to foo. The property default is not a valid workaround because it would not allow to distinguish the absence of that parameter.

How to handle this use case with picocli ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions