diff options
author | 2008-02-23 18:13:24 -0500 | |
---|---|---|
committer | 2008-02-23 18:13:24 -0500 | |
commit | 47b8c0db856c48abbcbcb5635deaa5c2cc41427e (patch) | |
tree | 2d94eab5c87463131001fc815e60acf0cc9c6f41 /core/init.lua | |
parent | 04a91f8ab1db479b48f26f3f808b74ba8a617e9b (diff) | |
download | textadept-47b8c0db856c48abbcbcb5635deaa5c2cc41427e.tar.gz textadept-47b8c0db856c48abbcbcb5635deaa5c2cc41427e.zip |
Eliminated Zenity dependency; replaced with my CocoaDialog clone (lua_dialog).
Diffstat (limited to 'core/init.lua')
-rw-r--r-- | core/init.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/init.lua b/core/init.lua index f699b8e0..d2eff849 100644 --- a/core/init.lua +++ b/core/init.lua @@ -14,6 +14,26 @@ function textadept.check_focused_buffer(buffer) end end +--- +-- Displays a CocoaDialog of a specified type with given arguments returning +-- the result. +-- @param kind The CocoaDialog type. +-- @param ... A table of key, value arguments. Each key is a --key switch with +-- a "value" value. If value is nil, it is omitted and just the switch is +-- used. +-- @return string CocoaDialog result. +function cocoa_dialog(kind, opts) + local args = '' + for k, v in pairs(opts) do + args = args..' --'..k + if type(v) == 'string' then args = args..' "'..v..'"' end + end + local p = io.popen('CocoaDialog '..kind..args) + local out = p:read('*all') + p:close() + return out +end + package.path = package.path..';'.._HOME..'/core/?.lua' require 'iface' |