Hi,
I found a bug while argument parsing in several DIALOG2 commands: [TM 2.0-alpha.9571]
E.g.:
"$DIALOG" x-insert --text "--Pitch" "$DIALOG" tooltip --text "--Pitch"
if you execute theses commands (via CTRL+R or within a script) DIALOG2 will fail due to the fact that the text argument begins with two "-".
Cheers, Hans
On 7 Oct 2014, at 14:30, Hans-Jörg Bibiko wrote:
[…] if you execute theses commands (via CTRL+R or within a script) DIALOG2 will fail due to the fact that the text argument begins with two "-".
I introduced ‘--’ as escape sequence in https://github.com/textmate/dialog/commit/fcb4f30fefe46fb423d5dc6ac4c07ee8ea...
That means you can use:
"$DIALOG" tooltip --text -- "--Pitch"
The problem is that the option parser does not have any template, so it does not know that --text expects an argument, instead it looks at the next string provided, to decide wether --text is a boolean or key/value option.
We should change it so that each subcommand provides the parser with an option template. With such template to guide the parsing, the escape sequence I just introduced may become invalid (as we would ideally use getopt_long rather than roll our own, and getopt_long does not support ‘--’ between an option and its argument).