Skip to content

Instantly share code, notes, and snippets.

@alphapapa
Forked from amzyang/createshortcut.js
Created October 23, 2016 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphapapa/51556e5e725d72e2593113e5c3b4d4e3 to your computer and use it in GitHub Desktop.
Save alphapapa/51556e5e725d72e2593113e5c3b4d4e3 to your computer and use it in GitHub Desktop.
create pentadactyl commandline options
// createshortcut.js -- ++pentadactyl
// @Author: eric.zou (frederick.zou@gmail.com)
// @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