Created
January 30, 2009 18:07
-
-
Save satyr/55171 to your computer and use it in GitHub Desktop.
Runs shell commands.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "shell", | |
icon: 'chrome://ubiquity/skin/icons/application_view_list.png', | |
takes: {command: noun_arb_text}, | |
description: 'Runs shell command.', | |
execute: function(inp, mod){ | |
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile), | |
proc = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess), | |
cmd = this._cmd(inp).split(/\s+/), [exe] = cmd, args = cmd.slice(1); | |
file.initWithPath(exe); | |
proc.init(file); | |
proc.run(false, args, args.length); | |
}, | |
preview: function(pbl, inp){ pbl.innerHTML = this._cmd(inp) }, | |
_cmd: function(inp) | |
Application.prefs.getValue('extensions.ubiquity.shell', | |
'C:\\Windows\\System32\\cmd.exe /c')+ | |
' '+ inp.text, | |
author: 'satyr'.link('http://d.hatena.ne.jp/murky-satyr'), license: 'MIT', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment