All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jio.console.EchoCommand Maven / Gradle / Ivy

There is a newer version: 3.0.0-RC2
Show newest version
package jio.console;

import jio.IO;
import jsonvalues.JsObj;

import java.util.function.Function;

/**
 * Represents a command that prints out a message into the console. Usage: {@code echo {text}}
 * 

* Example: {@code echo hi, how are you doing?} {@code echo $var} */ class EchoCommand extends Command { private static final String COMMAND_NAME = "echo"; public EchoCommand() { super(COMMAND_NAME, """ Prints out the message into the console. Usage: echo {text} Example: $command hi, how are you doing?""".replace("$command", COMMAND_NAME) ); } @Override public Function> apply(final JsObj conf, final State state ) { return tokens -> { int nArgs = tokens.length - 1; return nArgs == 0 ? IO.succeed("") : IO.succeed(Functions.joinTail(tokens)); }; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy