Package org.apache.jackrabbit.standalone.cli

Examples of org.apache.jackrabbit.standalone.cli.CommandLine


        Iterator iter = descriptors.iterator();

        // Tab position
        int tabPos = 20;
        while (iter.hasNext()) {
            CommandLine desc = (CommandLine) iter.next();
            if (desc.getName().length() > tabPos) {
                tabPos = desc.getName().length() + 1;
            }
        }

        iter = descriptors.iterator();
        while (iter.hasNext()) {
            CommandLine desc = (CommandLine) iter.next();
            StringBuffer buf = new StringBuffer(desc.getName());
            buf.setLength(tabPos);
            for (int i = desc.getName().length(); i < buf.length(); i++) {
                buf.setCharAt(i, ' ');
            }
            buf.append(desc.getLocalizedDescription());
            hf.printWrapped(out, 70, tabPos, buf.toString());
        }
    }
View Full Code Here


    private void helpCommand(Context ctx) throws CommandException {
        PrintWriter out = CommandHelper.getOutput(ctx);

        String cmdName = (String) ctx.get(this.commandKey);

        CommandLine desc = factory.getCommandLine(cmdName);

        out.println(getString(bundle, "word.description") + ": ");
        out.println(desc.getLocalizedDescription());
        out.println();

        // Usage
        out.print(getString(bundle, "word.usage") + ":");
        out.print(desc.getName() + " ");

        // Arguments
        Iterator iter = desc.getArguments().values().iterator();
        while (iter.hasNext()) {
            Argument arg = (Argument) iter.next();
            out.print("<" + arg.getLocalizedArgName() + "> ");
        }

        // Options
        iter = desc.getOptions().values().iterator();
        while (iter.hasNext()) {
            Option arg = (Option) iter.next();
            out.print("-" + arg.getName() + " <" + arg.getLocalizedArgName()
                    + "> ");
        }

        // flags
        iter = desc.getFlags().values().iterator();
        while (iter.hasNext()) {
            Flag arg = (Flag) iter.next();
            out.print("-" + arg.getName() + " ");
        }
        out.println();

        // Alias
        if (desc.getAlias().size() > 0) {
            out.print(getString(bundle, "word.alias") + ":");
            iter = desc.getAlias().iterator();
            while (iter.hasNext()) {
                out.print((String) iter.next() + " ");

            }
            out.println();
        }
        out.println();

        // Arguments details
        if (desc.getArguments().size() > 0) {
            out.println("<" + getString(bundle, "word.arguments") + ">");
            printParam(ctx, desc.getArguments().values());
        }

        // Options details
        if (desc.getOptions().values().size() > 0) {
            out.println();
            out.println("<" + getString(bundle, "word.options") + ">");
            printParam(ctx, desc.getOptions().values());
        }

        // flag details
        if (desc.getFlags().values().size() > 0) {
            out.println();
            out.println("<" + getString(bundle, "word.flags") + ">");
            printParam(ctx, desc.getFlags().values());
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.standalone.cli.CommandLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.