[txmt-dev] DIALOG behavior menu alert question/suggestion

Hans-Jörg Bibiko bibiko at eva.mpg.de
Mon Sep 24 10:59:01 UTC 2012


Hi,

I've a question and a suggestion regarding to DIALOG2.

1) DIALOG menu
There's a discrepancy of the result output. If you execute the menu example:

"$DIALOG" menu --items '({title = foo;}, {separator = 1;}, {header=1; title = bar;}, {title = baz;})'

and choose the item 'foo', it returns this:
<plist version="1.0">
<dict>
	<key>title</key>
	<string>foo</string>
</dict>
</plist>

Ok.

BUT if you choose 'baz':
<plist version="1.0">
<dict>
	<key>separator</key>
	<string>1</string>
</dict>
</plist>

This makes it rather difficult to parse the output plist.

Should I fix this to output always:
<plist version="1.0">
<dict>
	<key>title</key>
	<string>“chosen string”</string>
</dict>
</plist>

?

2) Output format for “alert”, “menu”
Esp. for bash coding it's an 'overkill' to return a plist which has to be parsed etc. to get the chosen item. How about to add an option “--output” to specify the output format?
The default would be as it is "as plist".

for alert:
--output index 
would simply return the chosen button index

for menu:
--output title
would simply return the chosen menu item title
--output index
would simply return the chosen menu item index [incl. separator, header]
then sometimes only the index is needed for post-processing


Regards,
--Hans






More information about the textmate-dev mailing list