001/*
002 * This file is part of Baritone.
003 *
004 * Baritone is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU Lesser General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * Baritone is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU Lesser General Public License for more details.
013 *
014 * You should have received a copy of the GNU Lesser General Public License
015 * along with Baritone.  If not, see <https://www.gnu.org/licenses/>.
016 */
017
018package baritone.api.command;
019
020import baritone.api.command.argument.IArgConsumer;
021import baritone.api.command.exception.CommandException;
022import baritone.api.utils.Helper;
023
024import java.util.List;
025import java.util.stream.Stream;
026
027/**
028 * The base for a command.
029 *
030 * @author Brady
031 * @since 10/7/2019
032 */
033public interface ICommand extends Helper {
034
035    /**
036     * Called when this command is executed.
037     */
038    void execute(String label, IArgConsumer args) throws CommandException;
039
040    /**
041     * Called when the command needs to tab complete. Return a Stream representing the entries to put in the completions
042     * list.
043     */
044    Stream<String> tabComplete(String label, IArgConsumer args) throws CommandException;
045
046    /**
047     * @return A <b>single-line</b> string containing a short description of this command's purpose.
048     */
049    String getShortDesc();
050
051    /**
052     * @return A list of lines that will be printed by the help command when the user wishes to view them.
053     */
054    List<String> getLongDesc();
055
056    /**
057     * @return A list of the names that can be accepted to have arguments passed to this command
058     */
059    List<String> getNames();
060
061    /**
062     * @return {@code true} if this command should be hidden from the help menu
063     */
064    default boolean hiddenFromHelp() {
065        return false;
066    }
067}