Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
@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());

Scripting can be implemented by recording arguments before executing the command.

 

Upsides:

  • Questions are grouped, this is ideal for generating wizards in Bndtools


Downsides:

  • The questions are "disconnected" from the command implementations. This is less obvious to program.
  • Difficult to support command completion

Annotated arguments

Code Block
@Command()
public void main(@Argument(name="name") String name, @Argument(name="type") FQN type) {	

	

Scripting can be implemented by recording arguments before executing the command.

Upsides:

  • Obvious to implement
  • Easy to support both passing arguments immediately, and asking the user for answers during execution of the command
  • Easy to implement argument completion


Downsides:

  • No way to group questions, besides just showing all of them in the same wizard. Note that this is only a problem when multiple wizard pages are required in Bndtools.