Module dev.metaschema.cli.processor
Interface ExtraArgument
- All Known Implementing Classes:
DefaultExtraArgument
public interface ExtraArgument
A representation of an extra, non-option command line argument.
-
Method Summary
Modifier and TypeMethodDescriptiongetName()Get the argument name.default intGet the allow number of arguments of this type.default Class<?>getType()Get the type for shell completion purposes.booleanGet if the argument is required.static ExtraArgumentnewInstance(String name, boolean required) Create a new extra argument instance.static ExtraArgumentnewInstance(String name, boolean required, Class<?> type) Create a new extra argument instance with type information for shell completion.
-
Method Details
-
newInstance
Create a new extra argument instance.- Parameters:
name- the argument namerequired-trueif the argument is required, orfalseotherwise- Returns:
- the instance
-
newInstance
@NonNull static ExtraArgument newInstance(@NonNull String name, boolean required, @Nullable Class<?> type) Create a new extra argument instance with type information for shell completion.- Parameters:
name- the argument namerequired-trueif the argument is required, orfalseotherwisetype- the type class for completion lookup, ornullfor freeform input- Returns:
- the instance
-
getName
String getName()Get the argument name.- Returns:
- the name
-
isRequired
boolean isRequired()Get if the argument is required.- Returns:
trueif the argument is required, orfalseotherwise
-
getNumber
default int getNumber()Get the allow number of arguments of this type.- Returns:
- the allowed number of arguments as a positive number or
-1for unlimited
-
getType
Get the type for shell completion purposes.The type is used by
CompletionTypeRegistryto lookup the appropriate completion behavior for this argument.- Returns:
- the type class used to determine shell completion behavior, or
nullfor freeform input
-