Skip to content

Commit

Permalink
Integrate reviews
Browse files Browse the repository at this point in the history
Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
  • Loading branch information
cescoffier committed Sep 14, 2015
1 parent 9e8b5f6 commit 1cfdc2b
Show file tree
Hide file tree
Showing 26 changed files with 604 additions and 573 deletions.
43 changes: 43 additions & 0 deletions src/main/asciidoc/cheatsheet/Argument.adoc
@@ -0,0 +1,43 @@
== Argument

++++
Defines a command line argument. Unlike options, argument don't have names and are identified using an index. The
first index is 0 (because we are in the computer world).
++++
'''

[cols=">25%,^25%,50%"]
[frame="topbot"]
|===
^|Name | Type ^| Description

|[[argName]]`argName`
|`String`
|+++
Sets the argument name of this link.+++

|[[defaultValue]]`defaultValue`
|`String`
|+++
Sets the default value of this link.+++

|[[description]]`description`
|`String`
|+++
Sets the description of the link.+++

|[[hidden]]`hidden`
|`Boolean`
|+++
Sets whether or not the current link is hidden.+++

|[[index]]`index`
|`Number (int)`
|+++
Sets the argument index.+++

|[[required]]`required`
|`Boolean`
|+++
Sets whether or not the current link is required.+++
|===
69 changes: 69 additions & 0 deletions src/main/asciidoc/cheatsheet/Option.adoc
@@ -0,0 +1,69 @@
== Option

++++
Models command line options. Options are values passed to a command line interface using -x or --x. Supported
syntaxes depend on the parser.
<p/>
Short name is generally used with a single dash, while long name requires a double-dash.
++++
'''

[cols=">25%,^25%,50%"]
[frame="topbot"]
|===
^|Name | Type ^| Description

|[[argName]]`argName`
|`String`
|+++
Sets te arg name for this option.+++

|[[defaultValue]]`defaultValue`
|`String`
|+++
Sets the default value of this option+++

|[[description]]`description`
|`String`
|+++
Sets te description of this option.+++

|[[flag]]`flag`
|`Boolean`
|+++
Configures the current link to be a flag. It will be evaluated to <code>true</code> if it's found in
the command line. If you need a flag that may receive a value, use, in this order:
<code><pre>
option.setFlag(true).setSingleValued(true)
</pre></code>+++

|[[hidden]]`hidden`
|`Boolean`
|+++
Sets whether or not this option should be hidden+++

|[[longName]]`longName`
|`String`
|+++
Sets the long name of this option.+++

|[[multiValued]]`multiValued`
|`Boolean`
|+++
Sets whether or not this option can receive several values.+++

|[[required]]`required`
|`Boolean`
|+++
Sets whether or not this option is mandatory.+++

|[[shortName]]`shortName`
|`String`
|+++
Sets the short name of this option.+++

|[[singleValued]]`singleValued`
|`Boolean`
|+++
Sets whether or not this option can receive a value.+++
|===
Expand Up @@ -20,13 +20,13 @@
import io.vertx.core.json.JsonArray;

/**
* Converter for {@link io.vertx.core.cli.ArgumentModel}.
* Converter for {@link io.vertx.core.cli.Argument}.
*
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.ArgumentModel} original class using Vert.x codegen.
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.Argument} original class using Vert.x codegen.
*/
public class ArgumentModelConverter {
public class ArgumentConverter {

public static void fromJson(JsonObject json, ArgumentModel obj) {
public static void fromJson(JsonObject json, Argument obj) {
if (json.getValue("argName") instanceof String) {
obj.setArgName((String)json.getValue("argName"));
}
Expand All @@ -47,7 +47,7 @@ public static void fromJson(JsonObject json, ArgumentModel obj) {
}
}

public static void toJson(ArgumentModel obj, JsonObject json) {
public static void toJson(Argument obj, JsonObject json) {
if (obj.getArgName() != null) {
json.put("argName", obj.getArgName());
}
Expand Down
Expand Up @@ -20,13 +20,13 @@
import io.vertx.core.json.JsonArray;

/**
* Converter for {@link io.vertx.core.cli.OptionModel}.
* Converter for {@link io.vertx.core.cli.Option}.
*
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.OptionModel} original class using Vert.x codegen.
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.Option} original class using Vert.x codegen.
*/
public class OptionModelConverter {
public class OptionConverter {

public static void fromJson(JsonObject json, OptionModel obj) {
public static void fromJson(JsonObject json, Option obj) {
if (json.getValue("argName") instanceof String) {
obj.setArgName((String)json.getValue("argName"));
}
Expand Down Expand Up @@ -59,7 +59,7 @@ public static void fromJson(JsonObject json, OptionModel obj) {
}
}

public static void toJson(OptionModel obj, JsonObject json) {
public static void toJson(Option obj, JsonObject json) {
if (obj.getArgName() != null) {
json.put("argName", obj.getArgName());
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/vertx/core/cli/AmbiguousOptionException.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2013 The original author or authors
* Copyright (c) 2011-2015 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -26,7 +26,7 @@
*/
public class AmbiguousOptionException extends CLIException {

private final List<OptionModel> options;
private final List<Option> options;
private final String token;


Expand All @@ -36,17 +36,17 @@ public class AmbiguousOptionException extends CLIException {
* @param token the ambiguous token
* @param matchingOpts the list of potential matches
*/
public AmbiguousOptionException(String token, List<OptionModel> matchingOpts) {
public AmbiguousOptionException(String token, List<Option> matchingOpts) {
super("Ambiguous argument in command line: '" + token + "' matches "
+ matchingOpts.stream().map(OptionModel::getName).collect(Collectors.toList()));
+ matchingOpts.stream().map(Option::getName).collect(Collectors.toList()));
this.token = token;
this.options = matchingOpts;
}

/**
* @return the list of potential matches.
*/
public List<OptionModel> getOptions() {
public List<Option> getOptions() {
return options;
}

Expand Down

0 comments on commit 1cfdc2b

Please sign in to comment.