[josm-dev] JOSM command line syntax and processing
Bodo Meissner
bodo at bodo-m.de
Thu Jan 7 15:28:10 GMT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello developers,
is there any documentation about Josm's command line arguments?
While thinking about bug 4288 I tried to understand the processing of command line arguments.
It looks a bit strange and I think it is difficult to change or to extend.
In order to fix the bug it must be possible to process a set of image files instead of individual files.
I'm not sure if the command line processing should be changed to handle this or if batch importers should handle this automatically with a little help from the command line processing.
Maybe it's a good idea to clean up the command line processing.
As far as I found out this is the current implementation:
The command line args are passed to main() as String argArray[].
The array values are copied to a List<String> argList.
A hash map that assigns a Collection of values to a key is created from argArray:
all values not starting with "--" are prepended with "--download="
if the value does not contain '=' everything after "--" is regarded as a key and an empty string will be added to the value list
if the value contains '=' the part between "--" and '=' is used as a key and the part after '=' is added to the values list of this key
(This implementation stores options like "-?" or "-h" in the has map in the values list of key "download".)
main() checks the HashMap for the existence of key "reset-preferences" (must have been --reset-preferences or --reset-preferences=foo) and for the first value of key "language" (--language=foo)
After this, main() checks argList for help options "--help", "-?" and "-h". In this case the program exits which means that the wrong values for the "download" key will be ignored
main() passes the HashMap args to preConstructorInit(args)
After creating the mainFrame and closing the splash screen, main() checks the HashMap args for "no-maximize", "geometry" and "maximize"
At the end of main() a Runnable is added to the event queue that will pass the HashMap args to main.postConstructorProcessCmdLine()
Main.postConstructorProcessCmd() handles keys "download", "downloadgps" and "selection".
All individual values of "download" and "downloadgps" are passed to downloadFromParamString() which distinguishes between "file:" and "http:" URLs, strings that contain exactly 3 commas which are trated as a bounding box and other strings that are treated as a file name.
"file:" URLs and file name arguments are handled individually by OpenFileAction.openFile().
Bodo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAktF/YoACgkQnMz9fgzDSqeBJQCdEMVUsRWAItc9Saa3ntxgxcQN
Z1IAn0w5zmE1oJIZ47MQdzQujHRAxwzT
=Pa1K
-----END PGP SIGNATURE-----
More information about the josm-dev
mailing list