Alon Bar-Lev has posted comments on this change.

Change subject: uutils: added new cli parser
......................................................................


Patch Set 2:

(4 comments)

https://gerrit.ovirt.org/#/c/40157/2/backend/manager/modules/uutils/src/main/java/org/ovirt/engine/core/uutils/cli/parser/ParametersParser.java
File 
backend/manager/modules/uutils/src/main/java/org/ovirt/engine/core/uutils/cli/parser/ParametersParser.java:

Line 65:     public Map<String, Object> parse(List<String> args) {
Line 66:         List<Object> others = new ArrayList<>();
Line 67:         List<Throwable> errors = new ArrayList<>();
Line 68:         Map<String, Object> argMap = new HashMap<>();
Line 69:         args.addAll(0, defaults);
this is not good, as it does not go vie the convertor....
Line 70: 
Line 71:         while(!args.isEmpty()) {
Line 72:             String arg = args.get(0);
Line 73:             if(!arg.startsWith(LONG_PREFIX)) {


Line 109:                         new IllegalArgumentException(
Line 110:                             String.format("Value is required, but 
missing for argument '%1$s'", key)
Line 111:                         )
Line 112:                     );
Line 113:                 }
.

 if (value == null) {
     value = parserArgument.getValue();
 }
Line 114:                 Object convertedValue = null;
Line 115:                 if (value != null) {
Line 116:                     Matcher m = 
parserArgument.getMatcher().matcher(value);
Line 117:                     if (!m.find()) {


https://gerrit.ovirt.org/#/c/40157/2/backend/manager/modules/uutils/src/main/resources/org/ovirt/engine/core/uutils/cli/parser/defaults.properties
File 
backend/manager/modules/uutils/src/main/resources/org/ovirt/engine/core/uutils/cli/parser/defaults.properties:

Line 1: arg.mandatory = false
add comments... so we remember what each is... :)
Line 2: arg.help = no help for this argument
Line 3: arg.type = no_argument
Line 4: arg.convert = java.lang.String
Line 5: arg.matcher = .*


Line 3: arg.type = no_argument
Line 4: arg.convert = java.lang.String
Line 5: arg.matcher = .*
Line 6: arg.metavar = STRING
Line 7: arg.multivalue = false
.

 # if argument exist but has no value, set this value
 # arg.value =
 # set this value as default
 # arg.default =
Line 8: help.usage =
Line 9: help.header =


-- 
To view, visit https://gerrit.ovirt.org/40157
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I00042b669e19293641579582223e7ca40717132d
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ondra Machacek <omach...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to