app/src/main/java/org/sakaiproject/nakamura/app/NakamuraMain.java
static Map<String, String> parseCommandLine(String[] args) {
		Map<String, String> commandLine = new HashMap<String, String>();
		boolean readUnparsed = false;
		for (int argc = 0; args != null && argc < args.length; argc++) {
			String arg = args[argc];

			if (readUnparsed) {
				commandLine.put(arg, arg);
			} else if (arg.startsWith("-")) {
				if (arg.length() == 1) {
					readUnparsed = true;
				} else {
					String key = String.valueOf(arg.charAt(1));
					if (arg.length() > 2) {
						commandLine.put(key, arg.substring(2));
					} else {
						argc++;
						if (argc < args.length
								&& (args[argc].equals("-") || !args[argc]
										.startsWith("-"))) {
							commandLine.put(key, args[argc]);
						} else {
							commandLine.put(key, key);
							argc--;
						}
					}
				}
			} else {
				commandLine.put(arg, arg);
			}
		}
		return commandLine;
	}
static Map<String, String> parseCommandLine(String[] args) {
		Map<String, String> commandLine = new HashMap<String, String>();
		boolean readUnparsed = false;
		for (int argc = 0; args != null && argc < args.length; argc++) {
			String arg = args[argc];

			if (readUnparsed) {
				commandLine.put(arg, arg);
			} else if (arg.startsWith("-")) {
				if (arg.length() == 1) {
					readUnparsed = true;
				} else {
					String key = String.valueOf(arg.charAt(1));
					if (arg.length() > 2) {
						commandLine.put(key, arg.substring(2));
					} else {
						argc++;
						if (argc < args.length
								&& (args[argc].equals("-") || !args[argc]
										.startsWith("-"))) {
							commandLine.put(key, args[argc]);
						} else {
							commandLine.put(key, key);
							argc--;
						}
					}
				}
			} else {
				commandLine.put(arg, arg);
			}
		}
		return commandLine;
	}
static Map < String , String > parseCommandLine ( String [ ] args ) { Map < String , String > commandLine = new HashMap < String , String > ( ) ; boolean readUnparsed = false ; for ( int argc = 0 ; args != null && argc < args . length ; argc ++ ) { String arg = args [ argc ] ; if ( readUnparsed ) { commandLine . put ( arg , arg ) ; } else if ( arg . startsWith ( "-" ) ) { if ( arg . length ( ) == 1 ) { readUnparsed = true ; } else { String key = String . valueOf ( arg . charAt ( 1 ) ) ; if ( arg . length ( ) > 2 ) { commandLine . put ( key , arg . substring ( 2 ) ) ; } else { argc ++ ; if ( argc < args . length && ( args [ argc ] . equals ( "-" ) || ! args [ argc ] . startsWith ( "-" ) ) ) { commandLine . put ( key , args [ argc ] ) ; } else { commandLine . put ( key , key ) ; argc -- ; } } } } else { commandLine . put ( arg , arg ) ; } } return commandLine ; }
Parses the command line arguments into a map of strings indexed by
strings. This method suppports single character option names only at the
moment. Each pair of an option name and its value is stored into the map.
If a single dash '-' character is encountered the rest of the command
line are interpreted as option names and are stored in the map unmodified
as entries with the same key and value.
<table>
<tr>
<th>Command Line</th>
<th>Mapping</th>
</tr>
<tr>
<td>x</td>
<td>x -> x</td>
</tr>
<tr>
<td>-y z</td>
<td>y -> z</td>
</tr>
<tr>
<td>-yz</td>
<td>y -> z</td>
</tr>
<tr>
<td>-y -z</td>
<td>y -> y, z -> z</td>
</tr>
<tr>
<td>-y x - -z a</td>
<td>y -> x, -z -> -z, a -> a</td>
</tr>
</table>

@param args
The command line to parse

@return The map of command line options and their values
Parses the command line arguments into a map of strings indexed by strings . This method suppports single character option names only at the moment . Each pair of an option name and its value is stored into the map . If a single dash - character is encountered the rest of the command line are interpreted as option names and are stored in the map unmodified as entries with the same key and value . <table > <tr > <th > Command Line< / th > <th > Mapping< / th > < / tr > <tr > <td > x< / td > <td > x - > x< / td > < / tr > <tr > <td > - y z< / td > <td > y - > z< / td > < / tr > <tr > <td > - yz< / td > <td > y - > z< / td > < / tr > <tr > <td > - y - z< / td > <td > y - > y z - > z< / td > < / tr > <tr > <td > - y x - - z a< / td > <td > y - > x - z - > - z a - > a< / td > < / tr > < / table >