[DEV] update parsing of arguments

This commit is contained in:
Edouard DUPIN 2021-06-17 22:34:47 +02:00
parent 1641e854df
commit 74e0a8dff2
2 changed files with 5 additions and 8 deletions

View File

@ -1,5 +1,5 @@
package org.atriasoft.death;
record ArgChoice(String val, String description) {
public record ArgChoice(String val, String description) {
}

View File

@ -70,22 +70,19 @@ public class Arguments {
this.listProperties.add(new ArgSection(sectionName, sectionDesc));
}
public void parse(final List<String> args) {
parse(args, 1);
public List<ArgElement> parse(final List<String> args) {
return parse(args, false);
}
public void parse(final List<String> args, final int startPositionParsing) {
parse(args, startPositionParsing, false);
}
/**
* Parse the argument set in the command line
* @param this Class handle
* @param startPositionParsing position to start the parsing in the arguments
*/
public List<ArgElement> parse(final List<String> args, final int startPositionParsing, final boolean haveUnknowArgument) {
public List<ArgElement> parse(final List<String> args, final boolean haveUnknowArgument) {
List<ArgElement> listArgument = new ArrayList<>();// composed of list element
boolean notParseNextElement=false;
for (int iii=startPositionParsing; iii <args.size(); iii++){
for (int iii=0; iii <args.size(); iii++){
this.lastElementParsed = iii;
// special case of parameter in some elements
if ( notParseNextElement) {