Package org.jline.shell.impl
Class AbstractCommand
- java.lang.Object
-
- org.jline.shell.impl.AbstractCommand
-
- All Implemented Interfaces:
Command
public abstract class AbstractCommand extends java.lang.Object implements Command
Base implementation ofCommandthat stores name and aliases.Example:
Command echo = new AbstractCommand("echo", "e") { @Override public Object execute(CommandSession session, String[] args) { session.out().println(String.join(" ", args)); return null; } };- Since:
- 4.0
- See Also:
Command
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCommand(java.lang.String name, java.lang.String... aliases)Creates a new command with the given name and optional aliases.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>aliases()Returns alternative names for this command.java.lang.Stringname()Returns the primary name of this command.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jline.shell.Command
completer, completers, describe, description, execute, subcommands
-
-
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:CommandReturns the primary name of this command.
-
-