summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/cli/CommandHandler.java
blob: fd40aa301d56ef0de0e4e370cdb0d3d8dd6f55b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package bjc.utils.cli;

import java.util.function.Function;

/**
 * A handler for a command.
 *
 * @author ben
 */
@FunctionalInterface
public interface CommandHandler extends Function<String[], CommandMode> {
	/**
	 * Execute this command.
	 *
	 * @param args
	 *                The arguments for this command.
	 *
	 * @return 
	 * 	The command mode to switch to after this command, or null to
	 *	stop executing commands.
	 */
	default CommandMode handle(final String[] args) {
		return this.apply(args);
	}
}