New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to define --foo= options in Arg #5197
Comments
Comment author: @damiendoligez I don't understand the need to annoy your users by forcing them to type = instead of the large easy-to-find space bar... The best way to implement this without polluting arg.mli too much is probably to add an optional argument to parse and parse_argv to tell them to accept = as a separator between flag and argument. |
Comment author: Richard Jones I think Arg should work like GNU getopt_long, ie. accept both --arg foo and --arg=foo. Someone has noted that our virt-* tools written in OCaml don't behave in the expected way (https://bugzilla.redhat.com/show_bug.cgi?id=1028650). I will try to come up with a suitable patch to the Arg module to allow it to accept both. |
Comment author: Richard Jones Sorry, I uploaded the wrong file first time. Please delete the first attachment (I can't work out how to delete attachments in Mantis). I am testing this patch: |
Comment author: Richard Jones FWIW I have been trying out my patch since 2013-11-09 with no |
Comment author: alavrik It looks like there may be a problem with this patch (assuming this is the same one that was pushed with the current Fedora). The actual problem seems to be that Arg.current has incorrect value (at least in some cases). The value is off by +1 from the value in the stock OCaml version. Please see this discussion for the details and steps to reproduce the problem: https://groups.google.com/d/msg/piqi/SZ97hEf8j7I/taK1eUx-AigJ And here's the actual code that exposes the difference in behavior: https://github.com/alavrik/piqi/blob/master/piqilib/piqi_getopt.ml#L349 |
Comment author: Richard Jones Do you have a tiny reproducer of the bug? |
Comment author: Richard Jones OK here's my reproducer: (* Run: argtest -- 1 2 3 *)
|
Comment author: Richard Jones Please can someone delete the attachment. The following two patches should fix the bug properly without changing http://oirase.annexia.org/tmp/0001-arg-Add-no_arg-and-get_arg-helper-functions.patch This only affects Fedora 21, and I will push a fix for it shortly. |
Comment author: Richard Jones The latest versions of my two patches are: https://git.fedorahosted.org/cgit/fedora-ocaml.git/commit/?h=fedora-24-4.02&id=e48a32ed47b6b5a77653ca3b40afb7c26aca7123 (See also this branch: https://git.fedorahosted.org/cgit/fedora-ocaml.git/log/?h=fedora-24-4.02 ) |
Comment author: @damiendoligez Fixed bug, added changelog entry and test, merged into trunk (commit 2512b48). |
Original bug ID: 5197
Reporter: @zoggy
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2015-11-25T21:27:51Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.12.0
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Tags: github, patch
Monitored by: "Richard Jones"
Bug description
Hello,
It seems that the standard way to define and use command line options is the following:
-f myarg
--foo=myarg
But the Arg module doesn't allow to define the second form. It allows only
--foo myarg
Would it be possible to allow the specification of such options ? Maybe by adding constructors to the Arg.spec type ?
Maxence
The text was updated successfully, but these errors were encountered: