aboutsummaryrefslogtreecommitdiff
path: root/core/init.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-02-23 18:13:24 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2008-02-23 18:13:24 -0500
commit47b8c0db856c48abbcbcb5635deaa5c2cc41427e (patch)
tree2d94eab5c87463131001fc815e60acf0cc9c6f41 /core/init.lua
parent04a91f8ab1db479b48f26f3f808b74ba8a617e9b (diff)
downloadtextadept-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.lua20
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'