Search in sources :

Example 1 with MagicCommandResult

use of com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandResult in project beakerx by twosigma.

the class HtmlMagicCommand method execute.

@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
    String commandCodeBlock = param.getCommandCodeBlock();
    if (commandCodeBlock == null) {
        return new MagicCommandOutput(MagicCommandOutput.Status.ERROR, String.format(USAGE_ERROR_MSG, HTML));
    }
    MIMEContainer html = HTML("<html>" + commandCodeBlock + "</html>");
    return new MagicCommandResult(MagicCommandOutcomeItem.Status.OK, html);
}
Also used : MagicCommandOutput(com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutput) MagicCommandResult(com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandResult) MIMEContainer(com.twosigma.beakerx.mimetype.MIMEContainer)

Example 2 with MagicCommandResult

use of com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandResult in project beakerx by twosigma.

the class JavaScriptMagicCommand method execute.

@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
    String commandCodeBlock = param.getCommandCodeBlock();
    MIMEContainer result = JavaScript(commandCodeBlock);
    return new MagicCommandResult(MagicCommandOutcomeItem.Status.OK, result);
}
Also used : MagicCommandResult(com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandResult) MIMEContainer(com.twosigma.beakerx.mimetype.MIMEContainer)

Aggregations

MagicCommandResult (com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandResult)2 MIMEContainer (com.twosigma.beakerx.mimetype.MIMEContainer)2 MagicCommandOutput (com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutput)1