summaryrefslogtreecommitdiff
path: root/scripts/context/stubs
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-08-10 00:00:15 +0300
committerMarius <mariausol@gmail.com>2012-08-10 00:00:15 +0300
commitfde392fe2694258c132ab6ac43068075a6a8e69d (patch)
tree14a3e957280577373348c82358d6ba96683d4805 /scripts/context/stubs
parent0b00489585cd59b7165030979c9244d9091dd952 (diff)
downloadcontext-fde392fe2694258c132ab6ac43068075a6a8e69d.tar.gz
beta 2012.08.09 20:28
Diffstat (limited to 'scripts/context/stubs')
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua25
-rw-r--r--scripts/context/stubs/unix/mtxrun25
2 files changed, 48 insertions, 2 deletions
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 5f2ecc2ac..3ebe0c0ba 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -3466,7 +3466,7 @@ url.escape = escapestring
function url.query(str)
if type(str) == "string" then
- return lpegmatch(splitquery,str)
+ return lpegmatch(splitquery,str) or ""
else
return str
end
@@ -16925,6 +16925,21 @@ function runners.timed(action)
statistics.timed(action)
end
+function runners.associate(filename)
+ os.launch(filename)
+end
+
+function runners.gethelp(filename)
+ local url = environment.argument("url")
+ if url and url ~= "" then
+ local command = string.gsub(environment.argument("command") or "unknown","^%s*\\*(.-)%s*$","%1")
+ url = utilities.templates.replace(url,{ command = command })
+ os.launch(url)
+ else
+ report("no --url given")
+ end
+end
+
-- this is a bit dirty ... first we store the first filename and next we
-- split the arguments so that we only see the ones meant for this script
-- ... later we will use the second half
@@ -17094,6 +17109,14 @@ elseif e_argument("launch") then
runners.loadbase()
runners.launch_file(filename)
+elseif e_argument("associate") then
+
+ runners.associate(filename)
+
+elseif e_argument("gethelp") then
+
+ runners.gethelp()
+
elseif e_argument("makestubs") then
-- make stubs (depricated)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 5f2ecc2ac..3ebe0c0ba 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -3466,7 +3466,7 @@ url.escape = escapestring
function url.query(str)
if type(str) == "string" then
- return lpegmatch(splitquery,str)
+ return lpegmatch(splitquery,str) or ""
else
return str
end
@@ -16925,6 +16925,21 @@ function runners.timed(action)
statistics.timed(action)
end
+function runners.associate(filename)
+ os.launch(filename)
+end
+
+function runners.gethelp(filename)
+ local url = environment.argument("url")
+ if url and url ~= "" then
+ local command = string.gsub(environment.argument("command") or "unknown","^%s*\\*(.-)%s*$","%1")
+ url = utilities.templates.replace(url,{ command = command })
+ os.launch(url)
+ else
+ report("no --url given")
+ end
+end
+
-- this is a bit dirty ... first we store the first filename and next we
-- split the arguments so that we only see the ones meant for this script
-- ... later we will use the second half
@@ -17094,6 +17109,14 @@ elseif e_argument("launch") then
runners.loadbase()
runners.launch_file(filename)
+elseif e_argument("associate") then
+
+ runners.associate(filename)
+
+elseif e_argument("gethelp") then
+
+ runners.gethelp()
+
elseif e_argument("makestubs") then
-- make stubs (depricated)