Search in sources :

Example 1 with CeylonTool

use of com.redhat.ceylon.common.tools.CeylonTool in project ceylon-compiler by ceylon.

the class CeylonDocToolTests method tool.

private CeylonDocTool tool(List<File> sourceFolders, List<File> docFolders, List<String> moduleName, boolean haltOnError, boolean deleteDestDir, boolean bootstrapCeylon, String... repositories) throws Exception {
    CeylonDocTool tool = new CeylonDocTool();
    tool.setSourceFolders(sourceFolders);
    tool.setRepositoryAsStrings(Arrays.asList(repositories));
    tool.setModuleSpecs(moduleName);
    tool.setDocFolders(docFolders);
    tool.setHaltOnError(haltOnError);
    tool.setBootstrapCeylon(bootstrapCeylon);
    File dir = new File("build", "CeylonDocToolTest/" + name.getMethodName());
    if (deleteDestDir && dir.exists()) {
        FileUtil.delete(dir);
    }
    tool.setOut(dir.getAbsolutePath());
    tool.initialize(new CeylonTool());
    return tool;
}
Also used : CeylonDocTool(com.redhat.ceylon.ceylondoc.CeylonDocTool) CeylonTool(com.redhat.ceylon.common.tools.CeylonTool) File(java.io.File)

Example 2 with CeylonTool

use of com.redhat.ceylon.common.tools.CeylonTool in project ceylon-compiler by ceylon.

the class CeylonBashCompletionTool method run.

@Override
public void run() throws Exception {
    // we don't care about arg0
    arguments.remove(0);
    cword--;
    final CompletionResults results;
    if (cword == 0) {
        // We're completing the name of the tool to run
        results = completeToolNames(arguments.isEmpty() ? "" : arguments.get(cword));
    } else if (cword < arguments.size()) {
        String argument = arguments.get(cword);
        CeylonTool main = new CeylonTool();
        main.setArgs(arguments);
        main.setToolLoader(toolLoader);
        ToolModel<?> tool = main.getToolModel();
        if (!afterEoo()) {
            if (argument.startsWith("--")) {
                if (argument.contains("=")) {
                    results = completeLongOptionArgument(tool, argument);
                } else {
                    results = completeLongOption(tool, argument);
                }
            } else if (argument.startsWith("-")) {
                /*TODO for (OptionModel<?> option : tool.getOptions()) {
                        if (argument.charAt(argument.length()-1) == option.getShortName()) {
                            complete
                        }
                    }*/
                results = new CompletionResults();
            } else {
                // TODO it's argument completion unless the previous argument was a 
                // non-pure short option
                results = new CompletionResults();
            }
        } else {
            // TODO else it must be argument completion
            results = new CompletionResults();
        }
    } else {
        // TODO we don't know what we're completing. 
        // First assume it's an argument...
        // ... but if the tool doesn't have any arguments (or all the 
        // arguments are already specified) then assume it's an option
        results = new CompletionResults();
    }
    results.emitCompletions();
}
Also used : ToolModel(com.redhat.ceylon.common.tool.ToolModel) CeylonTool(com.redhat.ceylon.common.tools.CeylonTool)

Example 3 with CeylonTool

use of com.redhat.ceylon.common.tools.CeylonTool in project ceylon-compiler by ceylon.

the class TopLevelToolTests method setup.

@Before
public void setup() {
    tool = new CeylonTool();
    tool.setToolLoader(toolLoader);
}
Also used : CeylonTool(com.redhat.ceylon.common.tools.CeylonTool) Before(org.junit.Before)

Aggregations

CeylonTool (com.redhat.ceylon.common.tools.CeylonTool)3 CeylonDocTool (com.redhat.ceylon.ceylondoc.CeylonDocTool)1 ToolModel (com.redhat.ceylon.common.tool.ToolModel)1 File (java.io.File)1 Before (org.junit.Before)1