1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 13:02:27 +01:00

add initial implementation of 'shell' and 'shellcmdflag' options

This commit is contained in:
Doug Kearns
2008-08-13 05:28:35 +00:00
parent e8eab457f7
commit 5a2b88c496
3 changed files with 49 additions and 8 deletions

1
NEWS
View File

@@ -15,6 +15,7 @@
generous donation which made this behavior possible)
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
too unpredictable
* add 'shell' and 'shellcmdflag' options
* :tabprevious, :bprevious, :tabnext, :bnext and friends now accept a prefix count
* add :comclear and :delcommand
* add a special version to :hardcopy to skip the Print dialog

View File

@@ -41,6 +41,34 @@ liberator.IO = function () //{{{
var extname = liberator.config.name.toLowerCase(); // "vimperator" or "muttator"
var lastRunCommand = ""; // updated whenever the users runs a command with :!
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
var shell, shellcmdflag;
if (WINDOWS)
{
shell = "cmd.exe";
// TODO: does setting 'shell' to "something containing sh"
// automatically update 'shellcmdflag' on Windows in Vim?
shellcmdflag = "/c";
}
else
{
shell = environmentService.get("SHELL") || "sh";
shellcmdflag = "-c";
}
// TODO: setter should expand environment variables
liberator.options.add(["shell", "sh"],
"Shell to use for executing :! and :run commands",
"string", shell);
liberator.options.add(["shellcmdflag", "shcf"],
"Flag passed to shell when executing :! and :run commands",
"string", shellcmdflag);
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
@@ -507,7 +535,6 @@ lookup:
// when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is fixed
// is fixed, should use that instead of a tmpfile
// TODO: add shell/shellcmdflag options to replace "sh" and "-c"
system: function (str, input)
{
var fileout = ioManager.createTempFile();
@@ -527,11 +554,8 @@ lookup:
command += " < \"" + filein.path.replace('"', '\\"') + "\"";
}
var res;
if (WINDOWS)
res = ioManager.run("cmd.exe", ["/C", command], true);
else
res = ioManager.run("sh", ["-c", command], true);
// FIXME: why is this return value being ignored?
var res = ioManager.run(liberator.options["shell"], [liberator.options["shellcmdflag"], command], true);
var output = ioManager.readFile(fileout);
fileout.remove(false);

View File

@@ -528,13 +528,29 @@ value can be reset to half the window height with [c]:set scroll=0[c].
____
|\'nosmd'| |\'noshowmode'| |\'smd'| |\'showmode'|
||'showmode' 'smd'|| boolean (default: on)
|\'shell'| |\'sh'|
||'shell' 'sh'|| string (default: on)
____
Show the current mode in the command line.
____
|\'shellcmdflag'| |\'shcf'|
||'shellcmdflag' 'shcf'|| string (default: $SHELL or "sh", Win32: "cmd.exe")
____
Shell to use for executing :! and :run commands.
____
|\'nosmd'| |\'noshowmode'| |\'smd'| |\'showmode'|
||'showmode' 'smd'|| boolean (default: "-c", Win32: "/c")
____
Flag passed to shell when executing :! and :run commands.
E.g. bash -c gvim
____
|\'ssli'| |\'showstatuslinks'|
||'showstatuslinks' 'ssli'|| number (default: 1)
____