Exemple #1
0
  /** Kick off the program */
  public static void main(String[] args) throws Throwable {
    // construct and run
    GoCoinCLI cli = new GoCoinCLI();

    // parse command line arguments
    Properties props = cli.initArgs(args);
    if (GoCoin.VERBOSE) {
      System.out.println("PROPERTIES:\n" + props);
    }

    // run the program
    try {
      cli.runProgram(props);
    } catch (Throwable t) {
      t.printStackTrace();
      System.exit(1);
    }
  }
Exemple #2
0
 /** @return the token by reading it from the file for a more secure CLI */
 public static final Token getTokenFromFile(String file) throws Exception {
   if (!GoCoin.hasValue(file)) {
     throw new FileNotFoundException("Token file must be passed!");
   }
   String token = GoCoinCLI.getFileContents(file);
   if (GoCoin.hasValue(token)) {
     token = token.replaceAll("\n", "").trim();
     return new Token(token, "", "");
   }
   return null;
 }