Package org.jboss.aesh.console

Examples of org.jboss.aesh.console.ConsoleCallback


            }
        };

        exampleConsole.addCompletion(completer);

        final ConsoleCallback consoleCallback = new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOperation output) {
                try {
                //To change body of implemented methods use File | Settings | File Templates.
                exampleConsole.getShell().out().print("======>\"" + output.getBuffer() + "\"\n");
                if(masking) {
                    exampleConsole.getShell().out().print("got password: " + output.getBuffer() + ", stopping masking");
                    masking = false;
                    exampleConsole.setPrompt(prompt);
                }
                else if (output.getBuffer().equalsIgnoreCase("quit") || output.getBuffer().equalsIgnoreCase("exit") ||
                        output.getBuffer().equalsIgnoreCase("reset")) {
                    exampleConsole.stop();
                }
                else if(output.getBuffer().equalsIgnoreCase("password")) {
                    masking = true;
                    exampleConsole.setPrompt(new Prompt("password: ", (char) 0));
                }
                else if(output.getBuffer().startsWith("blah")) {
                    exampleConsole.getShell().err().print("blah. command not found.\n");
                    exampleConsole.getShell().out().print("BAH" + Config.getLineSeparator());
                }
                else if(output.getBuffer().equals("clear"))
                    exampleConsole.clear();
                else if(output.getBuffer().startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    ConsoleCommand test =
                            new ExampleConsoleCommand(exampleConsole, output);
                    exampleConsole.attachProcess(test);
                }
                else if(output.getBuffer().startsWith("login")) {
                    exampleConsole.setConsoleCallback(passwordCallback);
                    exampleConsole.setPrompt(new Prompt("Username: "));
                }
                 return 0;
                }
                catch (IOException ioe) {
                    exampleConsole.getShell().out().println("Exception: "+ioe.getMessage());
                    return -1;
                }
            }
        };
        exampleConsole.setConsoleCallback(consoleCallback);
        exampleConsole.start();
        exampleConsole.setPrompt(prompt);

        passwordCallback = new ConsoleCallback() {
            private boolean hasUsername = false;

            @Override
            public int readConsoleOutput(ConsoleOperation output) {
                if(hasUsername) {
View Full Code Here


            }
        };

        exampleConsole.addCompletion(completer);

        final ConsoleCallback consoleCallback = new AeshConsoleCallback() {
            @Override
            public int execute(ConsoleOperation output) {
                try {
                //To change body of implemented methods use File | Settings | File Templates.
                exampleConsole.getShell().out().print("======>\"" + output.getBuffer() + "\"\n");
View Full Code Here

            }
        };

        exampleConsole.addCompletion(completer);

        final ConsoleCallback consoleCallback = new AeshConsoleCallback() {
            @Override
            public int execute(ConsoleOperation output) throws InterruptedException {
                try {
                //To change body of implemented methods use File | Settings | File Templates.
                exampleConsole.getShell().out().println("======>\"" + output.getBuffer());
View Full Code Here

        };

        exampleConsole.addCompletion(completer);

        final ConsoleOutput line;
        final ConsoleCallback consoleCallback = new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput output) throws IOException{
                //To change body of implemented methods use File | Settings | File Templates.

                exampleConsole.pushToStdOut("======>\"" + output.getBuffer() + "\"\n");
                if(masking) {
                    exampleConsole.pushToStdOut("got password: "+output.getBuffer()+", stopping masking");
                    masking = false;
                    exampleConsole.setPrompt(prompt);
                }
                else if (output.getBuffer().equalsIgnoreCase("quit") || output.getBuffer().equalsIgnoreCase("exit") ||
                        output.getBuffer().equalsIgnoreCase("reset")) {
                    exampleConsole.stop();
                }
                else if(output.getBuffer().equalsIgnoreCase("password")) {
                    masking = true;
                    exampleConsole.setPrompt(new Prompt("password: ", (char) 0));
                }
                else if(output.getBuffer().startsWith("blah")) {
                    exampleConsole.pushToStdErr("blah. command not found.\n");
                    exampleConsole.pushToStdOut("BAH"+ Config.getLineSeparator());
                }
                else if(output.getBuffer().equals("clear"))
                    exampleConsole.clear();
                else if(output.getBuffer().startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    test.attach(output);
                }
                else if(output.getBuffer().startsWith("login")) {
                    exampleConsole.setConsoleCallback(passwordCallback);
                    exampleConsole.setPrompt(new Prompt("Username: "));
                }
                 return 0;
            }
        };
        exampleConsole.setConsoleCallback(consoleCallback);
        exampleConsole.start();
        exampleConsole.setPrompt(prompt);

        passwordCallback = new ConsoleCallback() {
            private boolean hasUsername = false;

            @Override
            public int readConsoleOutput(ConsoleOutput output) throws IOException {
                if(hasUsername) {
View Full Code Here

        };

        exampleConsole.addCompletion(completer);

        final ConsoleOutput line;
        final ConsoleCallback consoleCallback = new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput output) throws IOException{
                //To change body of implemented methods use File | Settings | File Templates.

                exampleConsole.pushToStdOut("======>\"" + output.getBuffer() + "\"\n");
                if(masking) {
                    exampleConsole.pushToStdOut("got password: "+output.getBuffer()+", stopping masking");
                    masking = false;
                    exampleConsole.setPrompt(prompt);
                }
                else if (output.getBuffer().equalsIgnoreCase("quit") || output.getBuffer().equalsIgnoreCase("exit") ||
                        output.getBuffer().equalsIgnoreCase("reset")) {
                    exampleConsole.stop();
                }
                else if(output.getBuffer().equalsIgnoreCase("password")) {
                    masking = true;
                    exampleConsole.setPrompt(new Prompt("password: ", (char) 0));
                }
                else if(output.getBuffer().startsWith("blah")) {
                    exampleConsole.pushToStdErr("blah. command not found.\n");
                    exampleConsole.pushToStdOut("BAH"+ Config.getLineSeparator());
                }
                else if(output.getBuffer().equals("clear"))
                    exampleConsole.clear();
                else if(output.getBuffer().startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    test.attach(output);
                }
                else if(output.getBuffer().startsWith("login")) {
                    exampleConsole.setConsoleCallback(passwordCallback);
                    exampleConsole.setPrompt(new Prompt("Username: "));
                }
                 return 0;
            }
        };
        exampleConsole.setConsoleCallback(consoleCallback);
        exampleConsole.start();
        exampleConsole.setPrompt(prompt);

        passwordCallback = new ConsoleCallback() {
            private boolean hasUsername = false;

            @Override
            public int readConsoleOutput(ConsoleOutput output) throws IOException {
                if(hasUsername) {
View Full Code Here

        };

        exampleConsole.addCompletion(completer);

        final ConsoleOutput line;
        final ConsoleCallback consoleCallback = new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput output) throws IOException{
                //To change body of implemented methods use File | Settings | File Templates.

                exampleConsole.pushToStdOut("======>\"" + output.getBuffer() + "\"\n");
                if(masking) {
                    exampleConsole.pushToStdOut("got password: "+output.getBuffer()+", stopping masking");
                    masking = false;
                    exampleConsole.setPrompt(prompt);
                }
                else if (output.getBuffer().equalsIgnoreCase("quit") || output.getBuffer().equalsIgnoreCase("exit") ||
                        output.getBuffer().equalsIgnoreCase("reset")) {
                    exampleConsole.stop();
                }
                else if(output.getBuffer().equalsIgnoreCase("password")) {
                    masking = true;
                    exampleConsole.setPrompt(new Prompt("password: ", (char) 0));
                }
                else if(output.getBuffer().startsWith("blah")) {
                    exampleConsole.pushToStdErr("blah. command not found.\n");
                    exampleConsole.pushToStdOut("BAH"+ Config.getLineSeparator());
                }
                else if(output.getBuffer().equals("clear"))
                    exampleConsole.clear();
                else if(output.getBuffer().startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    test.attach(output);
                }
                else if(output.getBuffer().startsWith("login")) {
                    exampleConsole.setConsoleCallback(passwordCallback);
                    exampleConsole.setPrompt(new Prompt("Username: "));
                }
                 return 0;
            }
        };
        exampleConsole.setConsoleCallback(consoleCallback);
        exampleConsole.start();
        exampleConsole.setPrompt(prompt);

        passwordCallback = new ConsoleCallback() {
            private boolean hasUsername = false;

            @Override
            public int readConsoleOutput(ConsoleOutput output) throws IOException {
                if(hasUsername) {
View Full Code Here

        exampleConsole.addCompletion(more);

        exampleConsole.setPrompt(new Prompt("[test@foo]~> "));
        //exampleConsole.pushToConsole(ANSI.greenText());
        //while ((consoleOutput = exampleConsole.read("[test@foo.bar]~> ")) != null) {
        exampleConsole.setConsoleCallback(new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput consoleOutput) throws IOException {

                String line = consoleOutput.getBuffer();
                exampleConsole.pushToStdOut("======>\"" + line + "\"\n");
View Full Code Here

            }
        };

        exampleConsole.addCompletion(completer);

        final ConsoleCallback consoleCallback = new AeshConsoleCallback() {
            @Override
            public int execute(ConsoleOperation output) throws InterruptedException {
                try {
                //To change body of implemented methods use File | Settings | File Templates.
                exampleConsole.getShell().out().println("======>\"" + output.getBuffer());
View Full Code Here

            }
        };

        exampleConsole.addCompletion(completer);

        final ConsoleCallback consoleCallback = new AeshConsoleCallback() {
            @Override
            public int execute(ConsoleOperation output) {
                try {
                //To change body of implemented methods use File | Settings | File Templates.
                exampleConsole.getShell().out().println("======>\"" + output.getBuffer());
View Full Code Here

        exampleConsole.addCompletion(harlem);

        exampleConsole.setPrompt(new Prompt("[test@foo]~> "));
        //exampleConsole.pushToConsole(ANSI.greenText());
        //while ((consoleOutput = exampleConsole.read("[test@foo.bar]~> ")) != null) {
        exampleConsole.setConsoleCallback(new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput consoleOutput) throws IOException {

                String line = consoleOutput.getBuffer();
                exampleConsole.pushToStdOut("======>\"" + line + "\"\n");
View Full Code Here

TOP

Related Classes of org.jboss.aesh.console.ConsoleCallback

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.