Package jline

Examples of jline.History


            mode = ExecMode.SHELL;
            ConsoleReader reader = new ConsoleReader(System.in, new OutputStreamWriter(System.out));
            reader.setDefaultPrompt("grunt> ");
            final String HISTORYFILE = ".pig_history";
            String historyFile = System.getProperty("user.home") + File.separator  + HISTORYFILE;
            reader.setHistory(new History(new File(historyFile)));
            ConsoleReaderInputStream inputStream = new ConsoleReaderInputStream(reader);
            grunt = new Grunt(new BufferedReader(new InputStreamReader(inputStream)), pigContext);
            grunt.setConsoleReader(reader);
            gruntCalled = true;
            grunt.run();
View Full Code Here


            String historyFile = System.getProperty("user.home") + File.separator + HISTORYFILE;

            try
            {
                History history = new History(new File(historyFile));
                reader.setHistory(history);
            }
            catch (IOException exp)
            {
                sessionState.err.printf("Unable to open %s for writing %n", historyFile);
View Full Code Here

            console = new ConsoleReader();
            JLineHedwigCompletor completor = new JLineHedwigCompletor(admin);
            console.addCompletor(completor);

            // load history file
            History history = new History();
            File file = new File(System.getProperty("hw.history",
                                 new File(System.getProperty("user.home"), HW_HISTORY_FILE).toString()));
            if (LOG.isDebugEnabled()) {
                LOG.debug("History file is " + file.toString());
            }
            history.setHistoryFile(file);
            // set history to console reader
            console.setHistory(history);
            // load history from history file
            history.moveToFirstEntry();

            while (history.next()) {
                String entry = history.current();
                if (!entry.equals("")) {
                    addToHistory(commandCount, entry);
                }
                commandCount++;
            }
            System.out.println("JLine history support is enabled");

            String line;
            while ((line = console.readLine(getPrompt())) != null) {
                executeLine(line);
                history.addToHistory(line);
            }
        }

        inConsole = false;
        processCmd(cl);
View Full Code Here

    final String HISTORYFILE = ".hivehistory";
    String historyDirectory = System.getProperty("user.home");
    try {
      if ((new File(historyDirectory)).exists()) {
        String historyFile = historyDirectory + File.separator + HISTORYFILE;
        reader.setHistory(new History(new File(historyFile)));
      } else {
        System.err.println("WARNING: Directory for Hive history file: " + historyDirectory +
                           " does not exist.   History will not be available during this session.");
      }
    } catch (Exception e) {
View Full Code Here

            // initialize Readline library
            Terminal.setupTerminal();
            console = new ConsoleReader();
            console.addCompletor(new CollectionCompleter());
            try {
                final History history = new History(historyFile);
                console.setHistory(history);
            } catch (final Exception e) {
                // No error handling
            }
        }
View Full Code Here

          //Reader is created by first loading "pig.load.default.statements" or .pigbootup file if available
            ConsoleReader reader = new ConsoleReader(Utils.getCompositeStream(System.in, properties), new OutputStreamWriter(System.out));
            reader.setDefaultPrompt("grunt> ");
            final String HISTORYFILE = ".pig_history";
            String historyFile = System.getProperty("user.home") + File.separator  + HISTORYFILE;
            reader.setHistory(new History(new File(historyFile)));
            ConsoleReaderInputStream inputStream = new ConsoleReaderInputStream(reader);
            grunt = new LipstickGrunt(new BufferedReader(new InputStreamReader(inputStream)), pigContext);
            grunt.setConsoleReader(reader);
            gruntCalled = true;
            grunt.run();
View Full Code Here

           
            String historyFile = System.getProperty("user.home") + File.separator + HISTORYFILE;

            try
            {
                History history = new History(new File(historyFile));
                reader.setHistory(history);
            }
            catch (IOException exp)
            {
                sessionState.err.printf("Unable to open %s for writing %n", historyFile);
View Full Code Here

          //Reader is created by first loading "pig.load.default.statements" or .pigbootup file if available
            ConsoleReader reader = new ConsoleReader(Utils.getCompositeStream(System.in, properties), new OutputStreamWriter(System.out));
            reader.setDefaultPrompt("grunt> ");
            final String HISTORYFILE = ".pig_history";
            String historyFile = System.getProperty("user.home") + File.separator  + HISTORYFILE;
            reader.setHistory(new History(new File(historyFile)));
            ConsoleReaderInputStream inputStream = new ConsoleReaderInputStream(reader);
            grunt = new Grunt(new BufferedReader(new InputStreamReader(inputStream)), pigContext);
            grunt.setConsoleReader(reader);
            gruntCalled = true;
            grunt.run();
View Full Code Here

        for (final String evs : Imports.getEvaluates()) {
            groovy.execute(evs);
        }

        groovy.setResultHook(new ResultHookClosure(groovy, io, resultPrompt));
        groovy.setHistory(new History());

        final InteractiveShellRunner runner = new InteractiveShellRunner(groovy, new PromptClosure(groovy, inputPrompt));
        runner.setErrorHandler(new ErrorHookClosure(runner, io));
        try {
            runner.setHistory(new History(new File(System.getProperty("user.home") + "/" + HISTORY_FILE)));
        } catch (IOException e) {
            io.err.println("Unable to create history file: " + HISTORY_FILE);
        }

        Gremlin.load();
View Full Code Here

        GROOVYSH.execute("import com.tinkerpop.gremlin.Tokens.T");
        GROOVYSH.execute("import com.tinkerpop.gremlin.groovy.*");
        GROOVYSH.execute("import groovy.grape.Grape");

        GROOVYSH.setResultHook(new ResultHookClosure(GROOVYSH, STANDARD_IO, STANDARD_RESULT_PROMPT));
        GROOVYSH.setHistory(new History());

        final InteractiveShellRunner runner = new InteractiveShellRunner(GROOVYSH, new PromptClosure(GROOVYSH, STANDARD_INPUT_PROMPT));
        runner.setErrorHandler(new ErrorHookClosure(runner, STANDARD_IO));
        try {
            runner.setHistory(new History(new File(System.getProperty("user.home") + "/" + HISTORY_FILE)));
        } catch (IOException e) {
            STANDARD_IO.err.println("Unable to create history file: " + HISTORY_FILE);
        }

        Gremlin.load();
View Full Code Here

TOP

Related Classes of jline.History

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.