cli: parse reader features option
authorFrantišek Kučera <franta-hg@frantovo.cz>
Wed, 17 Sep 2014 19:13:47 +0200
changeset 98944a81a54bb9
parent 97 a72d55ff30c9
child 99 fadfde5b3e55
cli: parse reader features option
java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java
java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIParser.java
     1.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java	Sun Sep 07 01:28:07 2014 +0200
     1.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java	Wed Sep 17 19:13:47 2014 +0200
     1.3 @@ -23,7 +23,9 @@
     1.4  import java.io.InputStream;
     1.5  import java.io.OutputStream;
     1.6  import java.util.ArrayList;
     1.7 +import java.util.HashMap;
     1.8  import java.util.List;
     1.9 +import java.util.Map;
    1.10  import java.util.Properties;
    1.11  import java.util.logging.Level;
    1.12  import java.util.logging.LogRecord;
    1.13 @@ -45,6 +47,7 @@
    1.14  
    1.15  	private String systemId;
    1.16  	private final Properties readerProperties = new Properties();
    1.17 +	private final Map<String, Boolean> readerFeatures = new HashMap<>();
    1.18  
    1.19  	private OutputStream outputStream;
    1.20  	private String action;
    1.21 @@ -131,6 +134,14 @@
    1.22  		return readerProperties;
    1.23  	}
    1.24  
    1.25 +	public void addReaderFeature(String name, boolean value) {
    1.26 +		readerFeatures.put(name, value);
    1.27 +	}
    1.28 +
    1.29 +	public Map<String, Boolean> getReaderFeatures() {
    1.30 +		return readerFeatures;
    1.31 +	}
    1.32 +
    1.33  	public void addActionProperty(String name, String value) {
    1.34  		actionProperties.put(name, value);
    1.35  	}
     2.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIParser.java	Sun Sep 07 01:28:07 2014 +0200
     2.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIParser.java	Wed Sep 17 19:13:47 2014 +0200
     2.3 @@ -100,6 +100,16 @@
     2.4  						return index - originalIndex;
     2.5  					}
     2.6  				},
     2.7 +		READER_FEATURE("--reader-feature") {
     2.8 +					@Override
     2.9 +					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    2.10 +						int originalIndex = index;
    2.11 +						String name = fetchNext(args, ++index);
    2.12 +						String value = fetchNext(args, ++index);
    2.13 +						options.addReaderFeature(name, Boolean.valueOf(value));
    2.14 +						return index - originalIndex;
    2.15 +					}
    2.16 +				},
    2.17  		ACTION("--action") {
    2.18  					@Override
    2.19  					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {