Skip to content

Positional options should be configurable with annotations #605

Open
@jvalkeal

Description

@jvalkeal

CommandRegistration allows to define position info for an option. This is nice if user wants to have a feature to work without actual option names but also introduces difference for default functionality for annotation vs. programmatic registration.

This can be seen from a sample app:

my-shell:>e2e anno optional-value 
Hello null
my-shell:>e2e anno optional-value --arg1 asdf
Hello asdf
my-shell:>e2e anno optional-value asdf
Hello asdf

my-shell:>e2e reg optional-value
Hello null
my-shell:>e2e reg optional-value --arg1 asdf
Hello asdf
my-shell:>e2e reg optional-value asdf
Hello null

StandardMethodTargetRegistrar will automatically add positional info as it scans methods and its parameters, so it knows what positions to use. However force feeding this is not so nice!

Think about adding a global flag and/or tweaking current annotations to define it per command method. Need to be a bit careful what comes for changing existing @ShellMethod or @ShellOption annotations as completely new annotation model is about to get designed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions