Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Scattersphere
  * Copyright 2014-2015, Scattersphere Project.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.scattersphere.client;
This is the Scattersphere main command client. Created by kenji on 11/16/14.
public class Main {

    
Main entrypoint to the CLI.

Parameters:
args String[] of command line arguments, currently ignored.
Throws:
java.lang.Exception on any errors.
    public static void main(String args[]) throws Exception {
        ..println("    _____            __  __                       __                ");
        ..println("   / ___/_________ _/ /_/ /____  ______________  / /_  ___  ________");
        ..println("   \\__ \\/ ___/ __ `/ __/ __/ _ \\/ ___/ ___/ __ \\/ __ \\/ _ \\/ ___/ _ \\");
        ..println("  ___/ / /__/ /_/ / /_/ /_/  __/ /  (__  ) /_/ / / / /  __/ /  /  __/");
        ..println(" /____/\\___/\\__,_/\\__/\\__/\\___/_/  /____/ .___/_/ /_/\\___/_/   \\___/");
        ..println("                                       /_/");
        ..println();
        ..println("Scattersphere Client: Command line interface (CLI)");
        ..println("Type \"help\" for help.  Use arrows to navigate command history.\n");
        AtomicInteger commandCounter = new AtomicInteger(0);
        ConsoleReader reader = new ConsoleReader();
        String line;
        ClientCommandHandler handler = new ClientCommandHandler(reader);
        // Adds the ability to connect to a site by providing that address through the command line.
        if (args.length > 0) {
            handler.handle("connect " + args[0]);
        }
        reader.setPrompt(commandCounter.incrementAndGet() + "> ");
        while ((line = reader.readLine()) != null) {
            handler.handle(line);
            reader.setPrompt(commandCounter.incrementAndGet() + "> ");
        }
    }
New to GrepCode? Check out our FAQ X