
net.morimekta.terminal.args.SubCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of terminal Show documentation
Show all versions of terminal Show documentation
Utilities handling specialized terminal input and output.
The newest version!
package net.morimekta.terminal.args;
import net.morimekta.terminal.args.impl.SubCommandImpl;
import java.util.List;
import java.util.function.Function;
public interface SubCommand {
/**
* The sub-command name.
*
* @return The name.
*/
String getName();
/**
* The basic usage description.
*
* @return The usage description.
*/
String getUsage();
/**
* If the sub-command is hidden by default.
*
* @return True if hidden.
*/
boolean isHidden();
/**
* Get the list of sub-command aliases.
*
* @return The aliases.
*/
List getAliases();
/**
* Instantiate the selected commands' implementation.
*
* @param builder The argument parser builder that should contain the subcommand.
* @return The new sub-command instance.
*/
SubCommandDef newInstance(ArgParser.Builder builder);
interface Builder {
Builder alias(String... aliases);
Builder hidden();
SubCommand build();
}
static SubCommand.Builder subCommand(
String name,
String usage,
Function instanceFactory) {
return new SubCommandImpl.BuilderImpl<>(name, usage, instanceFactory);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy