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

org.duracloud.common.cli.GenericHelpCommand Maven / Gradle / Ivy

There is a newer version: 8.1.0
Show newest version
/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 *     http://duracloud.org/license/
 */
package org.duracloud.common.cli;

import java.util.Map;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.StringUtils;

/**
 * @author Daniel Bernstein
 */
public class GenericHelpCommand extends Command {
    private Map commandMap;

    public GenericHelpCommand(Map commandMap) {
        super("help");
        this.commandMap = commandMap;
    }

    @Override
    protected Options createOptions() {
        return new Options();
    }

    @Override
    protected void executeImpl(String[] args, CommandLine cl) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("(" + StringUtils.join(commandMap.keySet(), "|") + ") [options]", new Options());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy