#16866 closed enhancement (fixed)
Remove getopt
Reported by: | michael2402 | Owned by: | michael2402 |
---|---|---|---|
Priority: | normal | Milestone: | 18.11 |
Component: | Core | Version: | |
Keywords: | hack-weekend-2018-10 | Cc: |
Description ¶
Drop the gnu.getopt package
This is a really old C library and we would clean up our code a lot by using our own parser. This would also allow us to add common options (e.g. logging level, ...) to a common place.
Change History (12)
comment:1 by , 7 years ago
Owner: | changed from | to
---|
comment:2 by , 7 years ago
by , 7 years ago
Attachment: | remove-getopt.patch added |
---|
comment:4 by , 7 years ago
The patch is complete, just needs testing (I have not really played around with the program arguments and tested the two CLI applications)
TODO for sometime during this week.
comment:5 by , 7 years ago
Milestone: | 18.10 → 18.11 |
---|
comment:7 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Getopt is removed, let me know if there are any issues with the new parsing mechanism. I tested a few variants and added a full unit test for the parser logic, but there might be some cases that I missed.
While doing this I would like to drop some posix stuff that probably nobody uses (and that might be more confusing than useful). E.g.:
josm -W foo
is the same asjosm --foo
(we did not activate this)There are some other tweaks that are only activated if the system property gnu.posixly_correct is set (ignoring -- after short option, ...) that I will drop. An error message (e.g. missing argument) is displayed instead.
We will allow arguments to be specified before options.
So the format would be like this:
josm -o --option argument1 --with-arg=test --with-arg test -- argument2 argument3
--
is optional to mark all following arguments as non-properties to allow them to start with a--
(good for scripting)I don't think we will break any scripts using this because only few people are aware of the tweaks you could have done using posix getopts and fewer people used them.