Search in sources :

Example 1 with CeylonHelpTool

use of org.eclipse.ceylon.common.tools.help.CeylonHelpTool in project ceylon by eclipse.

the class Usage method printSynopsis.

private void printSynopsis(ToolModel<?> toolModel) throws Exception {
    if (!validToolName()) {
        return;
    }
    // Call the help tool to generate the usage
    out.newline();
    out.append(CeylonToolMessages.msg("usage")).newline();
    out.flush();
    // Can't call rootTool.bootstrap() because that would replace the
    // rootTool's toolName, which we need when printing option suggestions
    CeylonHelpTool r = new CeylonHelpTool();
    r.setToolLoader(rootTool.getPluginLoader());
    r.setSynopsis(true);
    r.setTool(toolModel);
    r.run();
    out.newline();
}
Also used : CeylonHelpTool(org.eclipse.ceylon.common.tools.help.CeylonHelpTool)

Example 2 with CeylonHelpTool

use of org.eclipse.ceylon.common.tools.help.CeylonHelpTool in project ceylon by eclipse.

the class TopLevelToolTests method getHelpOutput.

private String getHelpOutput(String toolName) {
    StringWriter sw = new StringWriter();
    CeylonHelpTool helpTool = new CeylonHelpTool();
    helpTool.setToolLoader(toolLoader);
    if (toolName != null && !toolName.isEmpty()) {
        helpTool.setTool(toolLoader.loadToolModel(toolName));
    }
    helpTool.setOut(sw);
    helpTool.run();
    return sw.toString();
}
Also used : StringWriter(java.io.StringWriter) CeylonHelpTool(org.eclipse.ceylon.common.tools.help.CeylonHelpTool)

Example 3 with CeylonHelpTool

use of org.eclipse.ceylon.common.tools.help.CeylonHelpTool in project ceylon by eclipse.

the class HelpToolTests method testHelpHelp.

@Test
public void testHelpHelp() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("help"));
    tool.run();
}
Also used : CeylonHelpTool(org.eclipse.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Example 4 with CeylonHelpTool

use of org.eclipse.ceylon.common.tools.help.CeylonHelpTool in project ceylon by eclipse.

the class HelpToolTests method testHelpCompiler.

@Test
public void testHelpCompiler() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("compile"));
    tool.setToolLoader(pluginLoader);
    tool.run();
    try {
        pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("--", "compile", "--javac="));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Unexpected argument '--javac=' to command 'help'", e.getMessage());
    }
}
Also used : OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) CeylonHelpTool(org.eclipse.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Example 5 with CeylonHelpTool

use of org.eclipse.ceylon.common.tools.help.CeylonHelpTool in project ceylon by eclipse.

the class HelpToolTests method testHelp.

@Test
public void testHelp() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    Assert.assertTrue(model.isPorcelain());
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>emptyList());
    tool.run();
}
Also used : CeylonHelpTool(org.eclipse.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Aggregations

CeylonHelpTool (org.eclipse.ceylon.common.tools.help.CeylonHelpTool)9 Test (org.junit.Test)6 StringWriter (java.io.StringWriter)1 OptionArgumentException (org.eclipse.ceylon.common.tool.OptionArgumentException)1