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

io.vertx.reactivex.core.cli.CLI Maven / Gradle / Ivy

There is a newer version: 4.5.10
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat 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 io.vertx.reactivex.core.cli;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.core.cli.Option;
import java.util.List;
import io.vertx.core.cli.Argument;

/**
 * Interface defining a command-line interface (in other words a command such as 'run', 'ls'...).
 * This interface is polyglot to ease reuse such as in Vert.x Shell.
 * 

* A command line interface has a name, and defines a set of options and arguments. Options are key-value pair such * as -foo=bar or -flag. The supported formats depend on the used parser. Arguments are unlike * options raw values. Options are defined using * {@link io.vertx.core.cli.Option}, while argument are defined using {@link io.vertx.core.cli.Argument}. *

* Command line interfaces also define a summary and a description. These attributes are used in the usage generation * . To disable the help generation, set the hidden attribute to true. *

* Command Line Interface object does not contains "value", it's a model. It must be evaluated by a * parser that returns a {@link io.vertx.reactivex.core.cli.CommandLine} object containing the argument and option values. * *

* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.CLI original} non RX-ified interface using Vert.x codegen. */ @io.vertx.lang.reactivex.RxGen(io.vertx.core.cli.CLI.class) public class CLI { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CLI that = (CLI) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.reactivex.TypeArg __TYPE_ARG = new io.vertx.lang.reactivex.TypeArg<>( obj -> new CLI((io.vertx.core.cli.CLI) obj), CLI::getDelegate ); private final io.vertx.core.cli.CLI delegate; public CLI(io.vertx.core.cli.CLI delegate) { this.delegate = delegate; } public io.vertx.core.cli.CLI getDelegate() { return delegate; } /** * Creates an instance of {@link io.vertx.reactivex.core.cli.CLI} using the default implementation. * @param name the name of the CLI (must not be null) * @return the created instance of {@link io.vertx.reactivex.core.cli.CLI} */ public static CLI create(String name) { CLI ret = CLI.newInstance(io.vertx.core.cli.CLI.create(name)); return ret; } /** * Parses the user command line interface and create a new {@link io.vertx.reactivex.core.cli.CommandLine} containing extracting values. * @param arguments the arguments * @return the creates command line */ public CommandLine parse(List arguments) { CommandLine ret = CommandLine.newInstance(delegate.parse(arguments)); return ret; } /** * Parses the user command line interface and create a new {@link io.vertx.reactivex.core.cli.CommandLine} containing extracting values. * @param arguments the arguments * @param validate enable / disable parsing validation * @return the creates command line */ public CommandLine parse(List arguments, boolean validate) { CommandLine ret = CommandLine.newInstance(delegate.parse(arguments, validate)); return ret; } /** * @return the CLI name. */ public String getName() { String ret = delegate.getName(); return ret; } /** * Sets the name of the CLI. * @param name the name * @return the current {@link io.vertx.reactivex.core.cli.CLI} instance */ public CLI setName(String name) { delegate.setName(name); return this; } /** * @return the CLI description. */ public String getDescription() { String ret = delegate.getDescription(); return ret; } public CLI setDescription(String desc) { delegate.setDescription(desc); return this; } /** * @return the CLI summary. */ public String getSummary() { String ret = delegate.getSummary(); return ret; } /** * Sets the summary of the CLI. * @param summary the summary * @return the current {@link io.vertx.reactivex.core.cli.CLI} instance */ public CLI setSummary(String summary) { delegate.setSummary(summary); return this; } /** * Checks whether or not the current {@link io.vertx.reactivex.core.cli.CLI} instance is hidden. * @return true if the current {@link io.vertx.reactivex.core.cli.CLI} is hidden, otherwise */ public boolean isHidden() { boolean ret = delegate.isHidden(); return ret; } /** * Sets whether or not the current instance of {@link io.vertx.reactivex.core.cli.CLI} must be hidden. Hidden CLI are not listed when * displaying usages / help messages. In other words, hidden commands are for power user. * @param hidden enables or disables the hidden aspect of the CI * @return the current {@link io.vertx.reactivex.core.cli.CLI} instance */ public CLI setHidden(boolean hidden) { delegate.setHidden(hidden); return this; } /** * Gets the list of options. * @return the list of options, empty if none. */ public List





© 2015 - 2024 Weber Informatics LLC | Privacy Policy