Package org.jboss.aesh.console.command

Examples of org.jboss.aesh.console.command.CommandOperation


                    parsing = false;
                }

                //if we have a command hooked in the input goes there
                if(command != null)
                    command.processOperation(new CommandOperation(input));
                //the input is parsed by æsh
                else {
                    Operation operation = editMode.parseInput(inc, buffer.getLine());
                    if(inc != Key.UNKNOWN)
                        operation.setInput(inc.getKeyValues());
View Full Code Here


            shell.out().print(ANSI.getMainBufferScreen());
        }

        public void processOperation(CommandInvocation invocation) throws IOException {

            CommandOperation operation;
            try {
                operation = invocation.getInput();
                while(!operation.getInputKey().equals(Key.q)) {
                    shell.out().print((char) operation.getInput()[0]);
                    shell.out().flush();
                    operation = invocation.getInput();
                }
                if(operation.getInput()[0] == 'q') {
                    stop();
                }
            }
            catch (InterruptedException e) {
                stop();
View Full Code Here

        @Override
        public CommandResult execute(CommandInvocation commandInvocation) throws IOException {
            this.shell = commandInvocation.getShell();
            if(bar) {
                shell.out().print("are you sure you want bar? (y/n) ");
                CommandOperation operation = null;
                try {
                    operation = commandInvocation.getInput();
                }
                catch (InterruptedException e) {
                    return CommandResult.FAILURE;
View Full Code Here

                    exampleConsole.clear();
                else if(output.getBuffer().startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    //man = new ExampleConsoleCommand(exampleConsole, output);
                    exampleConsole.getShell().out().println("trying to wait for input");
                    CommandOperation co = null;
                    try {
                        co = getInput();
                    }
                    catch (InterruptedException e) {
                        e.printStackTrace();
                        return -1;
                    }
                    exampleConsole.getShell().out().println("got: " + co.toString());
                    //exampleConsole.attachProcess(test);
                }
                else if(output.getBuffer().startsWith("login")) {
                    exampleConsole.setConsoleCallback(passwordCallback);
                    exampleConsole.setPrompt(new Prompt("Username: "));
View Full Code Here

                }
                else {
                    parsing = false;
                }

                inputQueue.put(new CommandOperation(inc, input, position));

                if(!processManager.hasRunningProcess())
                    processInternalOperation(getInput());

            }
View Full Code Here

                    exampleConsole.clear();
                else if(output.getBuffer().startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    //man = new ExampleConsoleCommand(exampleConsole, output);
                    exampleConsole.getShell().out().println("trying to wait for input");
                    CommandOperation co = null;
                    try {
                        co = getInput();
                    }
                    catch (InterruptedException e) {
                        e.printStackTrace();
                        return -1;
                    }
                    exampleConsole.getShell().out().println("got: " + co.toString());
                    //exampleConsole.attachProcess(test);
                }
                else if(output.getBuffer().startsWith("login")) {
                    exampleConsole.setConsoleCallback(passwordCallback);
                    exampleConsole.setPrompt(new Prompt("Username: "));
View Full Code Here

                    parsing = false;
                }

                //if we have a command hooked in the input goes there
                if(command != null)
                    command.processOperation(new CommandOperation(input));
                //the input is parsed by æsh
                else {
                    Operation operation = editMode.parseInput(inc, buffer.getLine());
                    if(inc != Key.UNKNOWN)
                        operation.setInput(inc.getKeyValues());
View Full Code Here

        Shell shell = commandInvocation.getShell();
        if (r.exists()) {
            if (r.isLeaf()) {
                if (interactive) {
                    shell.out().println("remove regular file '" + r.getName() + "' ? (y/n)");
                    CommandOperation operation = commandInvocation.getInput();
                    if (operation.getInputKey() == Key.y) {
                        r.delete();
                    }
                } else {
                    r.delete();
                }
View Full Code Here

        Shell shell = commandInvocation.getShell();
        if (r.exists()) {
            if (r.isDirectory()) {
                if (interactive) {
                    shell.out().println("remove directory '" + r.getName() + "' ? (y/n)");
                    CommandOperation operation = commandInvocation.getInput();
                    if (operation.getInputKey() == Key.y) {
                        r.delete();
                    }
                } else {
                    r.delete();
                }
View Full Code Here

    public void processOperation() throws IOException {
        boolean attach = true;
        try {
            while(attach) {
                CommandOperation operation = commandInvocation.getInput();
                if(operation.getInputKey() == Key.q) {
                    attach = false;
                }
                else if( operation.getInputKey() == Key.ENTER) {
                    topVisibleRow = topVisibleRow + getNumber();
                    if(topVisibleRow > (page.size()-rows)) {
                        topVisibleRow = page.size()-rows;
                        if(topVisibleRow < 0)
                            topVisibleRow = 0;
                        display(Background.INVERSE);
                        attach = false;
                    }
                    else
                        display(Background.INVERSE);
                    clearNumber();
                }
                // ctrl-f ||  space
                else if(operation.getInputKey() == Key.CTRL_F ||
                        operation.getInputKey() == Key.SPACE) {
                    topVisibleRow = topVisibleRow + rows*getNumber();
                    if(topVisibleRow > (page.size()-rows)) {
                        topVisibleRow = page.size()-rows;
                        if(topVisibleRow < 0)
                            topVisibleRow = 0;
                        display(Background.INVERSE);
                        attach = false;
                    }
                    else
                        display(Background.INVERSE);
                    clearNumber();
                }
                else if(operation.getInputKey() == Key.CTRL_B) { // ctrl-b
                    topVisibleRow = topVisibleRow - rows*getNumber();
                    if(topVisibleRow < 0)
                        topVisibleRow = 0;
                    display(Background.INVERSE);
                    clearNumber();
                }
                else if(Character.isDigit(operation.getInput()[0])) {
                    number.append(Character.getNumericValue(operation.getInput()[0]));
                }
            }
        }
        catch (InterruptedException ie) {
        }
View Full Code Here

TOP

Related Classes of org.jboss.aesh.console.command.CommandOperation

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.