We discussed several approaches to declare arguments for commands. There are three use cases that must be supported.
- Interactive shell
- Bndtools UI
- Scripts
Metatype interfaces
In this approach the arguments are grouped in interfaces.
@Meta.OCD interface NameAndType { enum TYPE { CLASS, INTERFACE }; @Meta.AD(name="FQN", description="The fully qualified name of the class.") FQN name(); @Meta.AD(description="The type (class or interface)") TYPE type(); } @Command() public void main() { NameAndType nat = m_prompt.ask(NameAndType.class, values); System.out.println("N: " + nat.name()); System.out.println("T: " + nat.type());