Package jline.console

Examples of jline.console.ConsoleReader


  private boolean logErrorsToConsole = false;
  private PrintWriter writer = null;
  private boolean masking = false;

  public Shell() throws IOException {
    this(new ConsoleReader(), new PrintWriter(
        new OutputStreamWriter(System.out,
        System.getProperty("jline.WindowsTerminal.output.encoding", System.getProperty("file.encoding")))));
  }
View Full Code Here


      this.done = false;
      this.cmd = null;
      this.cmdIndex = 0;
      this.readWait = false;
      this.output = new StringBuilderOutputStream();
      ConsoleReader reader = new ConsoleReader(this, output);
      this.shell = new Shell(reader, new PrintWriter(new OutputStreamWriter(output, Constants.UTF8)));
      shell.setLogErrorsToConsole();
      if (mock != null) {
        if (shell.config("--fake", "-u", username, "-p", password))
          throw new IOException("mock shell config error");
View Full Code Here

    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    Shell.log.setLevel(Level.OFF);
    output = new TestOutputStream();
    input = new StringInputStream();
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(output));
    shell = new Shell(new ConsoleReader(input, output), pw);
    shell.setLogErrorsToConsole();
    shell.config("--fake", "-u", "test", "-p", "secret");
  }
View Full Code Here

     * @return true if the user confirm
     * @throws IOException
     */
    public static boolean accessToSystemBundleIsAllowed(long bundleId, CommandSession session) throws IOException {
        for (;;) {
            ConsoleReader reader = (ConsoleReader) session.get(".jline.reader");
            String msg = "You are about to access system bundle " + bundleId + ".  Do you wish to continue (yes/no): ";
            String str = reader.readLine(msg);
            if ("yes".equalsIgnoreCase(str)) {
                return true;
            }
            if ("no".equalsIgnoreCase(str)) {
                return false;
View Full Code Here

        if (level == null) {
            System.out.println("Level " + sl.getBundleStartLevel(bundle));
        }
        else if ((level < 50) && (sl.getBundleStartLevel(bundle) > 50) && !force){
            for (;;) {
                ConsoleReader reader = (ConsoleReader) session.get(".jline.reader");
                String msg = "You are about to designate bundle as a system bundle.  Do you wish to continue (yes/no): ";
                String str = reader.readLine(msg);
                if ("yes".equalsIgnoreCase(str)) {
                    sl.setBundleStartLevel(bundle, level);
                    break;
                } else if ("no".equalsIgnoreCase(str)) {
                    break;
View Full Code Here

        }

        for (; ; ) {
            String karafName = System.getProperty("karaf.name");
            String msg = String.format("Confirm: shutdown instance %s (yes/no): ", karafName);
            ConsoleReader reader = (ConsoleReader) session.get(".jline.reader");
            String str = reader.readLine(msg);
            if (str.equalsIgnoreCase("yes")) {
                this.shutdown(sleep);
            }
            return null;
        }
View Full Code Here

        this.consoleInput = new ConsoleInputStream();
        this.session = processor.createSession(this.consoleInput, this.out, this.err);
        this.session.put("SCOPE", "shell:osgi:*");
        this.closeCallback = closeCallback;

        reader = new ConsoleReader(null,
                                   this.consoleInput,
                                   this.out,
                                   this.terminal,
                                   encoding);

View Full Code Here

    if (row == null) {
      out.println("Row [" + rowId + "] not found.");
      return;
    }
    int maxWidth = 100;
    ConsoleReader reader = getConsoleReader();
    if (reader != null) {
      Terminal terminal = reader.getTerminal();
      maxWidth = terminal.getWidth() - 15;
      out.setLineLimit(terminal.getHeight() - 2);
    }
    format(out, rowResult, maxWidth);
  }
View Full Code Here

    if (Main.debug) {
      out.println(blurQuery);
    }

    int maxWidth = 100;
    ConsoleReader reader = getConsoleReader();
    if (reader != null) {
      Terminal terminal = reader.getTerminal();
      maxWidth = terminal.getWidth() - 15;
      out.setLineLimit(terminal.getHeight() - 2);
    }
    long s = System.nanoTime();
    BlurResults blurResults = client.query(tablename, blurQuery);
View Full Code Here

      String node = args[1];

      out.println("Are you sure you want to remove the shard server [" + node + "]? [y/N]");
      out.flush();

      ConsoleReader reader = getConsoleReader();
      try {
        int readCharacter = reader.readCharacter();
        if (!(readCharacter == 'y' || readCharacter == 'Y')) {
          return;
        }
      } catch (IOException e) {
        if (Main.debug) {
View Full Code Here

TOP

Related Classes of jline.console.ConsoleReader

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.