Package org.jnode.shell.help

Examples of org.jnode.shell.help.CompletionException


                command.setCommandInfo(commandInfo);
            }
            command.setArgumentAnticipated(argumentAnticipated);
            command.complete(completions, shell);
        } catch (ShellException ex) {
            throw new CompletionException("Shell exception", ex);
        }
    }
View Full Code Here


        if (!cmd.equals("") && (argumentTokens.length > 0 || argumentAnticipated)) {
            CommandInfo ci;
            try {
                ci = getCommandInfo(shell);
            } catch (ShellException ex) {
                throw new CompletionException(ex.getMessage(), ex);
            }
           
            Command command;
            try {
                command = ci.createCommandInstance();
            } catch (Throwable ex) {
                throw new CompletionException("Problem creating a command instance", ex);
            }

            // Get the command's argument bundle and syntax
            ArgumentBundle bundle = (command == null)
                ? ci.getArgumentBundle()
                : command.getArgumentBundle();
            SyntaxBundle syntaxes = ci.getSyntaxBundle();
            if (syntaxes == null) {
                syntaxes = shell.getSyntaxManager().getSyntaxBundle(cmd);
            }

            if (bundle == null) {
                // We're missing the argument bundle.  We assume this is a 'classic' Java application
                // that does its own argument parsing and completion like a UNIX shell; i.e.
                // completing each argument as a pathname.
                Syntax syntax = new RepeatSyntax(new ArgumentSyntax("argument"));
                syntaxes = new SyntaxBundle(cmd, syntax);
                bundle = new ArgumentBundle(
                    new FileArgument("argument", Argument.MULTIPLE));
            } else if (syntaxes == null) {
                // We're missing the syntax, but we do have an argument bundle.  Generate
                // a default syntax from the bundle.
                syntaxes = new SyntaxBundle(cmd, bundle.createDefaultSyntax());
            }  
            try {
                bundle.complete(this, syntaxes, completions);
            } catch (CommandSyntaxException ex) {
                throw new CompletionException("Command syntax problem", ex);
            }
        } else {
            // We haven't got a command name yet, so complete the partial command name string
            // as an AliasArgument.
            ArgumentCompleter ac = new ArgumentCompleter(
View Full Code Here

TOP

Related Classes of org.jnode.shell.help.CompletionException

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.