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

jio.console.JsPrettyCommand 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;

class JsPrettyCommand extends Command {

  private static final String COMMAND_NAME = "json-pretty";

  public JsPrettyCommand() {
    super(COMMAND_NAME,
          "Returns the json placed at the output variable in a pretty format"
         );
  }

  @Override
  public Function> apply(final JsObj conf,
                                              final State state
                                             ) {
    return tokens -> IO.lazy(() ->
                                 Functions.toJson
                                     .apply(state.variables.get("output"))
                                     .toPrettyString()
                            );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy