Examples of SimpleCommandLineParser


Examples of sample.util.SimpleCommandLineParser

   * Social activities are only available to authenticated users.
   *
   * @param args Used to pass the username and password of a test account.
   */
  public static void main(String[] args) {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);
    String username = parser.getValue("username", "user", "u");
    String password = parser.getValue("password", "pass", "p");
    boolean help = parser.containsKey("help", "h");
    boolean authenticated = (username != null) && (password != null);

    if (help) {
      printUsage();
      System.exit(1);
View Full Code Here

Examples of sample.util.SimpleCommandLineParser

   * Main entry point.  Parses arguments and creates and invokes the
   * CodeSearchClient.
   */
  public static void main(String[] arg)
      throws Exception {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(arg);
    String query = parser.getValue("query", "query", "q");
    String nresults = parser.getValue("nresults", "nresults", "nr");
    String start = parser.getValue("start", "index", "start");

    boolean help = parser.containsKey("help", "h");
    if (help || (query == null)) {
      usage();
      System.exit(1);
    }

View Full Code Here

Examples of sample.util.SimpleCommandLineParser

    output.println("Keywords after update: "
        + updatedEntry.getMediaGroup().getKeywords().getKeywords());
  }

  public static void main(String[] args) throws IOException, ServiceException {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);
    String username = parser.getValue("username", "user", "u");
    String password = parser.getValue("password", "pass", "p");
    String developerKey = parser.getValue("key", "k");
    boolean help = parser.containsKey("help", "h");

    if (help || username == null || password == null || developerKey == null) {
      printUsage();
      System.exit(1);
    }
View Full Code Here

Examples of sample.util.SimpleCommandLineParser

   * This sample demonstrates both upload and write activities in the API.
   *
   * @param args Used to pass the username and password of a test account.
   */
  public static void main(String[] args) {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);
    String username = parser.getValue("username", "user", "u");
    String password = parser.getValue("password", "pass", "p");
    String developerKey = parser.getValue("key", "k");
    boolean help = parser.containsKey("help", "h");

    if (help || username == null || password == null || developerKey == null) {
      printUsage();
      System.exit(1);
    }
View Full Code Here

Examples of sample.util.SimpleCommandLineParser

   * @param args See the usage method.
   */
  public static void main(String[] args) {

    // Set username, password and feed URI from command-line arguments.
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);
    String userName = parser.getValue("username", "user", "u");
    String userPassword = parser.getValue("password", "pass", "p");
    boolean help = parser.containsKey("help", "h");
    if (help || (userName == null) || (userPassword == null)) {
      usage();
      System.exit(1);
    }

View Full Code Here

Examples of sample.util.SimpleCommandLineParser

   * uses resumable upload feature to upload large media.
   *
   * @param args Used to pass the username and password of a test account.
   */
  public static void main(String[] args) {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);
    String username = parser.getValue("username", "user", "u");
    String password = parser.getValue("password", "pass", "p");
    String developerKey = parser.getValue("key", "k");
    boolean help = parser.containsKey("help", "h");

    if (help || username == null || password == null || developerKey == null) {
      printUsage();
      System.exit(1);
    }
View Full Code Here

Examples of sample.util.SimpleCommandLineParser

   *                                     --admin_password [pass]
   *                                     --domain [domain]
   */
  public static void main(String[] arg)
      throws Exception {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(arg);
    String adminEmail = parser.getValue("admin_email", "email", "e");
    String adminPassword = parser.getValue("admin_password", "pass", "p");
    String domain = parser.getValue("domain", "domain", "d");

    boolean help = parser.containsKey("help", "h");
    if (help || (adminEmail == null) || (adminPassword == null) || (domain == null)) {
      usage();
      System.exit(1);
    }

View Full Code Here

Examples of sample.util.SimpleCommandLineParser

  /**
   * @param args
   */
  public static void main(String[] args) {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);
    String adminEmail = parser.getValue("admin_email", "email", "e");
    String adminPassword = parser.getValue("admin_password", "pass", "p");
    String domain = parser.getValue("domain", "domain", "d");

    boolean help = parser.containsKey("help", "h");
    if (help || (adminEmail == null) || (adminPassword == null) || (domain == null)) {
      usage();
      System.exit(1);
    }

View Full Code Here

Examples of sample.util.SimpleCommandLineParser

   * Usage: java AppsForYourDomainMigrationClient --username <user>
   * --password <pass> --domain <domain>
   * [--destination_user <destination_user>] [--data_file <file>]
   */
  public static void main(String[] arg) throws Exception {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(arg);

    // Parse command-line flags
    String username = parser.getValue("username");
    String password = parser.getValue("password");
    String domain = parser.getValue("domain");
    String destinationUser = parser.getValue("destination_user");
    String emailFileName = parser.getValue("data_file");
   
    boolean help = parser.containsKey("help");
    if (help || (username == null) || (password == null)
             || (domain == null)) {
      usage();
      System.exit(1);
    }
View Full Code Here

Examples of sample.util.SimpleCommandLineParser

    printResults(resultFeed);
  }

  private DocumentQuery createQueryFromArgs(String[] args) throws IOException {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

    System.out.println("You asked to list documents....");

    URL feedUrl = FeedUris.getDocumentsFeedUrl();
    DocumentQuery query = new DocumentQuery(feedUrl);

    if (parser.containsKey("onlydeleted")) {
      System.out.println("...that are deleted");
      query.setOnlydeleted(true);
    }

    if (parser.containsKey("onlyhidden")) {
      System.out.println("...that are hidden");
      Query.CategoryFilter filter = new Query.CategoryFilter();
      filter.addCategory(new HiddenCategory());
      query.addCategoryFilter(filter);
    }

    if (parser.containsKey("excludehidden")) {
      System.out.println("...that are not hidden");
      Query.CategoryFilter filter = new Query.CategoryFilter();
      filter.addExcludeCategory(new HiddenCategory());
      query.addCategoryFilter(filter);
    }

    String sharedWithEmail = parser.getValue("sharedwith");
    if (sharedWithEmail != null) {
      System.out.println("...that are shared with " + sharedWithEmail);
      query.setSharedWithEmailId(sharedWithEmail);
    }

    String startIndex = parser.getValue("start-index");
    if (startIndex != null) {
      System.out.println("...that start from position " + startIndex);
      query.setStartIndex(Integer.parseInt(startIndex));
    }

    String maxResults = parser.getValue("max-results");
    if (maxResults != null) {
      System.out.println("...and you don't want more than " + maxResults
          + " results");
      query.setMaxResults(Integer.parseInt(maxResults));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.