Skip to content

Instantly share code, notes, and snippets.

@amzyang
Created November 29, 2011 07:03
Show Gist options
  • Save amzyang/1403804 to your computer and use it in GitHub Desktop.
Save amzyang/1403804 to your computer and use it in GitHub Desktop.
create pentadactyl commandline options
// createshortcut.js -- ++pentadactyl
// @Author: eric.zou ([email protected])
// @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
// @Created: Tue 29 Nov 2011 01:24:05 PM CST
// @Last Change: Tue 29 Nov 2011 02:23:36 PM CST
// @Revision: 41
// @Description:
// @Usage:
// @TODO:
// @CHANGES:
group.commands.add(["createshortcut"],
"Create Shortcut",
function (args) {
if (args.length == 0)
return false;
var command_ascii = args[0];
if (args["-javascript"])
command_ascii = "js " + command_ascii;
command_ascii = escape(command_ascii);
var output = <>-pentadactyl "++cmd 'execute unescape(&lt;>{command_ascii}&lt;/>.toString())'"</>;
dactyl.echo(output, commandline.FORCE_MULTILINE);
},
{
argCount: "?",
literal: 0,
completer: function(context, args) {
if (!args["-javascript"])
return completion.ex(context);
return completion.javascript(context);
},
options: [
{
names: ["-javascript", "-js", "-j"],
description: "execute javascript code.",
type: CommandOption.NOARG,
completer: completion.javascript
}
]
},
true
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment