All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.parquet.tools.Main Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.parquet.tools;

import java.io.IOException;

import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;

import org.apache.parquet.tools.command.Command;
import org.apache.parquet.tools.command.Registry;

public class Main {
  public static final Options OPTIONS;
  public static PrintStream out;
  public static PrintStream err;

  static {
    OPTIONS = new Options();
    Option help = OptionBuilder.withLongOpt("help")
                               .withDescription("Show this help string")
                               .create('h');

    Option ncol = OptionBuilder.withLongOpt("no-color")
                               .withDescription("Disable color output even if supported")
                               .create();

    Option debg = OptionBuilder.withLongOpt("debug")
                               .withDescription("Enable debug output")
                               .create();

    OPTIONS.addOption(help);
    OPTIONS.addOption(ncol);
    OPTIONS.addOption(debg);
  }

  private static final int WIDTH = 80;
  private static final int LEFT_PAD = 4;
  private static final int DESC_PAD = 2;

  public static void mergeOptionsInto(Options opt, Options opts) {
    if (opts == null) {
      return;
    }

    Collection




© 2015 - 2024 Weber Informatics LLC | Privacy Policy