CLI

Command Line Interface

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

org.testinfected
Идентификатор

Идентификатор

cli
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

CLI
Command Line Interface
Ссылка на сайт

Ссылка на сайт

https://github.com/testinfected/cli
Система контроля версий

Система контроля версий

https://github.com/testinfected/cli

Скачать cli

Имя Файла Размер
cli-1.0.pom
cli-1.0.jar 26 KB
cli-1.0-sources.jar 19 KB
cli-1.0-javadoc.jar 163 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.testinfected/cli/ -->
<dependency>
    <groupId>org.testinfected</groupId>
    <artifactId>cli</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.testinfected/cli/
implementation 'org.testinfected:cli:1.0'
// https://jarcasting.com/artifacts/org.testinfected/cli/
implementation ("org.testinfected:cli:1.0")
'org.testinfected:cli:jar:1.0'
<dependency org="org.testinfected" name="cli" rev="1.0">
  <artifact name="cli" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.testinfected', module='cli', version='1.0')
)
libraryDependencies += "org.testinfected" % "cli" % "1.0"
[org.testinfected/cli "1.0"]

Зависимости

test (4)

Идентификатор библиотеки Тип Версия
junit : junit-dep jar 4.10
org.hamcrest : hamcrest-all jar 1.3
org.jmock : jmock jar 2.5.1
org.jmock : jmock-junit4 jar 2.5.1

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status

Getting Started

Build yourself (for latest version) using Gradle or Maven, or simply download from Maven Central:

<dependency>
      <groupId>com.vtence.cli</groupId>
      <artifactId>cli</artifactId>
      <version>1.1</version>
</dependency>

First let's define a command line:

CLI cli = new CLI() {{
    name("petstore"); version("1.0");
    description("A web application built without frameworks");

    option("-e", "--environment ENV", "Environment to use for configuration (default: development)").defaultingTo("development");
    option("-h", "--host HOST", "Host address to bind to (default: 0.0.0.0)").defaultingTo("0.0.0.0");
    option("-p", "--port PORT", "Port to listen on (default: 8080)").ofType(int.class).defaultingTo(8080);
    option("--timeout SECONDS", "Session timeout in seconds (default: 15 min)").ofType(int.class).defaultingTo(900);
    flag("-q", "--quiet", "Operate quietly");
    flag("-h", "--help", "Print this help message");

    operand("webroot", "Location of the web application").ofType(File.class);
    
    epilog("use --help to show this help message");
}};

Now assuming program is started with:

-p 8088 -e production --timeout 9000 /path/to/webapp/root

Here's how we would parse the arguments:

cli.parse(args); // Typical program args

String env = cli.get("-e");
String host = cli.get("-h");
int port = cli.get("-p");
int timeout = cli.get("--timeout");
boolean quiet = cli.has("-q");

File webroot = cli.get("webroot");

Want to know more?

Checkout out usage examples

Версии библиотеки

Версия
1.0