Inceptum/src/main/java/io/gitlab/jfronny/inceptum/cli/Command.java

34 lines
745 B
Java
Raw Normal View History

2021-10-30 22:05:24 +02:00
package io.gitlab.jfronny.inceptum.cli;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
public abstract class Command {
private final String help;
private final List<String> aliases;
public Command(String help, String... aliases) {
this.help = help;
this.aliases = Arrays.asList(aliases);
}
public boolean isAlias(String text) {
return aliases.contains(text.replaceAll("^[-/]*", "").toLowerCase(Locale.ROOT));
}
public String getName() {
return aliases.get(0);
}
public String getHelp() {
return help;
}
public boolean enableLog() {
return false;
}
2021-11-24 16:02:33 +01:00
public abstract void invoke(InvokedCommandDescription args);
2021-10-30 22:05:24 +02:00
}