Package jline

Examples of jline.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


  public boolean config(String... args) {
    configError = super.config(args);
   
    // Update the ConsoleReader with the input and output "redirected"
    try {
      this.reader = new ConsoleReader(in, writer);
    } catch (Exception e) {
      printException(e);
      configError = true;
    }
   
View Full Code Here

  @Before
  public void setupShell() throws Exception {
    // start the shell
    output = new TestOutputStream();
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(output));
    shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), new OutputStreamWriter(output)), pw);
    shell.setLogErrorsToConsole();
    shell.config("-u", "root", "-p", secret, "-z", cluster.getInstanceName(), cluster.getZooKeepers());
    exec("quit", true);
    shell.start();
    shell.setExit(false);
View Full Code Here

  @Before
  public void setup() throws IOException {
    Shell.log.setLevel(Level.OFF);
    output = new TestOutputStream();
    PrintWriter pw = new PrintWriter( new OutputStreamWriter(output));
    shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), new OutputStreamWriter(output)), pw);
    shell.setLogErrorsToConsole();
    shell.config("--fake", "-u", "test", "-p", "secret");
  }
View Full Code Here

  private static ConsoleReader reader = null;
  private static IZooReaderWriter zoo = ZooReaderWriter.getInstance();

  private static ConsoleReader getConsoleReader() throws IOException {
    if (reader == null)
      reader = new ConsoleReader();
    return reader;
  }
View Full Code Here

    if (!zookeeperAvailable()) {
      log.fatal("Zookeeper needs to be up and running in order to init. Exiting ...");
      return false;
    }
    if (sconf.get(Property.INSTANCE_SECRET).equals(Property.INSTANCE_SECRET.getDefaultValue())) {
      ConsoleReader c = getConsoleReader();
      c.beep();
      c.printNewline();
      c.printNewline();
      c.printString("Warning!!! Your instance secret is still set to the default, this is not secure. We highly recommend you change it.");
      c.printNewline();
      c.printNewline();
      c.printNewline();
      c.printString("You can change the instance secret in accumulo by using:");
      c.printNewline();
      c.printString("   bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName() + " oldPassword newPassword.");
      c.printNewline();
      c.printString("You will also need to edit your secret in your configuration file by adding the property instance.secret to your conf/accumulo-site.xml. Without this accumulo will not operate correctly");
      c.printNewline();
    }

    try {
      if (isInitialized(fs)) {
        String instanceDfsDir = sconf.get(Property.INSTANCE_DFS_DIR);
View Full Code Here

        System.exit(1);
    }

    private static void repl() throws MinException, IOException {
        //Boolean LoopAgain = true;
        ConsoleReader console = new ConsoleReader();
        console.setDefaultPrompt("min> ");

        String input;
        Message message;

        System.out.println("REPL (experimental)");
        System.out.println("-------------------");
        System.out.println("Type 'bye' to exit\n");

        while(true) {
            input = console.readLine();
            if(input.equals("bye"))  break;

            try {
                message = Message.parse(input, "<eval>");
                if(debug) System.out.println("debug >> " + message.fullName());
View Full Code Here

    System.out.println("Type 'exit;' or '\\q' to quit.");

    connect(mConf.get(AUTOCONNECT_URL_KEY, DEFAULT_AUTOCONNECT_URL));

    HistoryFile history = new HistoryFile();
    ConsoleReader conReader = new ConsoleReader();
    history.populateConsoleReader(conReader);
    history.open();

    mInCommand = false;
    mCmdBuilder = new StringBuilder();

    try {
      while (true) {
        printPrompt();
        String line = conReader.readLine();
        if (null == line) {
          // EOF on input. We're done.
          throw new QuitException(0);
        } else if (line.endsWith("\\c")) {
          // Lines ending in '\\c' cancel the current input.
View Full Code Here

  private static ConsoleReader reader = null;
  private static IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 
  private static ConsoleReader getConsoleReader() throws IOException {
    if (reader == null)
      reader = new ConsoleReader();
    return reader;
  }
View Full Code Here

    if (!zookeeperAvailable()) {
      log.fatal("Zookeeper needs to be up and running in order to init. Exiting ...");
      return false;
    }
    if (sconf.get(Property.INSTANCE_SECRET).equals(Property.INSTANCE_SECRET.getDefaultValue())) {
      ConsoleReader c = getConsoleReader();
      c.beep();
      c.printNewline();
      c.printNewline();
      c.printString("Warning!!! Your instance secret is still set to the default, this is not secure. We highly recommend you change it.");
      c.printNewline();
      c.printNewline();
      c.printNewline();
      c.printString("You can change the instance secret in accumulo by using:");
      c.printNewline();
      c.printString("   bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName() + " oldPassword newPassword.");
      c.printNewline();
      c.printString("You will also need to edit your secret in your configuration file by adding the property instance.secret to your conf/accumulo-site.xml. Without this accumulo will not operate correctly");
      c.printNewline();
    }
   
    try {
      if (isInitialized(fs)) {
        String instanceDfsDir = sconf.get(Property.INSTANCE_DFS_DIR);
View Full Code Here

TOP

Related Classes of jline.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.