@@ -90,19 +90,26 @@ private static String readAll(InputStream in) throws IOException {
9090
9191 private static RunnerConfig readArgs (String [] args ) throws ConfigException {
9292 RunnerConfig conf = null ;
93- if (args != null )
94- for (String a : args ) {
93+ if (args != null ) {
94+ Properties p = new Properties ();
95+ for (String a : args ) {
9596 if (a .startsWith ("-c:" )) { // config
96- Properties p = new Properties ();
9797 try {
9898 p .load (new FileReader (a .substring ("-c:" .length ())));
9999 } catch (IOException e ) {
100100 throw new ConfigException ("configFile" , "Reading config file" , e );
101101 }
102- conf = BeanReader .fromProperties (p , RunnerConfig .class );
103- } // else if ... for any other args TODO
102+ } else if (a != null && a .startsWith ("-p:" )) {
103+ String s = a .substring ("-p:" .length ());
104+ int idxEq = s != null ? s .indexOf ("=" ):-1 ;
105+ if (idxEq < 0 )
106+ throw new ConfigException (s , "Param argument must be: -p:name=value" );
107+ else
108+ p .setProperty (s .substring (0 , idxEq ), s .substring (idxEq + 1 ));
109+ }
104110 }
105- else
111+ conf = BeanReader .fromProperties (p , RunnerConfig .class );
112+ } else
106113 throw new ConfigException (null , "No arguments" );
107114 // default values (cant use constructor, explicit or implicit)
108115 if (conf .getPrintFieldSeparator () == null )
0 commit comments