/*
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. 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.wso2.testgrid.core.command;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.testgrid.common.exception.CommandExecutionException;
import org.wso2.testgrid.common.util.StringUtil;

/**
 * This class lists the available functions.
 *
 * @since 1.0.0
 */
public class HelpCommand implements Command {

    private static final Logger logger = LoggerFactory.getLogger(HelpCommand.class);

    @Override
    public void execute() throws CommandExecutionException {
        String ls = System.lineSeparator();
        String usageBuilder = StringUtil.concatStrings(ls,
                "usage: create-product-testplan -p PRODUCT_NAME -v PRODUCT_VERSION -c CHANNEL", ls,
                "usage: run-testplan -p PRODUCT_NAME -v PRODUCT_VERSION -c CHANNEL -t TESTPLAN_PATH -ir " +
                "INFRA_REPO_PATH -sr SCENARIO_REPO_PATH", ls,
                "usage: generate-infrastructure-plan -p PRODUCT_NAME -v PRODUCT_VERSION -c CHANNEL -i " +
                "INFRASTRUCTURE_CONFIG_YAML_PATH", ls,
                "usage: generate-report -p PRODUCT_NAME -v PRODUCT_VERSION -c CHANNEL", ls,
                "usage: help", ls,
                "example: sh testgrid.sh create-product-testplan -p wso2is -v 5.3.0 -c LTS", ls,
                "example: sh testgrid.sh run-testplan -p wso2is -v 5.3.0 -c LTS -t ./my-testplan.yaml", ls);
        logger.info(usageBuilder);
    }

    /**
     * fixing args4j issue of showing the class id in the help output.
     */
    @Override
    public String toString() {
        return "";
    }
}
