mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 08:07:58 +01:00
Purge unnecessary uses of args.string.
This commit is contained in:
@@ -382,7 +382,7 @@ const Bookmarks = Module("bookmarks", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
else {
|
else {
|
||||||
let url = args.string || buffer.URL;
|
let url = args[0] || buffer.URL;
|
||||||
let deletedCount = bookmarks.remove(url);
|
let deletedCount = bookmarks.remove(url);
|
||||||
|
|
||||||
dactyl.echomsg({ domains: [util.getHost(url)], message: deletedCount + " bookmark(s) with url " + url.quote() + " deleted" },
|
dactyl.echomsg({ domains: [util.getHost(url)], message: deletedCount + " bookmark(s) with url " + url.quote() + " deleted" },
|
||||||
|
|||||||
@@ -171,10 +171,8 @@ const Browser = Module("browser", {
|
|||||||
commands.add(["o[pen]"],
|
commands.add(["o[pen]"],
|
||||||
"Open one or more URLs in the current tab",
|
"Open one or more URLs in the current tab",
|
||||||
function (args) {
|
function (args) {
|
||||||
args = args.string;
|
if (args[0])
|
||||||
|
dactyl.open(args[0]);
|
||||||
if (args)
|
|
||||||
dactyl.open(args);
|
|
||||||
else
|
else
|
||||||
dactyl.open("about:blank");
|
dactyl.open("about:blank");
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -1437,7 +1437,7 @@ const CommandLine = Module("commandline", {
|
|||||||
commands.add([command.name],
|
commands.add([command.name],
|
||||||
command.description,
|
command.description,
|
||||||
function (args) {
|
function (args) {
|
||||||
let str = CommandLine.echoArgumentToString(args.string, true);
|
let str = CommandLine.echoArgumentToString(args[0], true);
|
||||||
if (str != null)
|
if (str != null)
|
||||||
command.action(str);
|
command.action(str);
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -1415,13 +1415,13 @@ const Dactyl = Module("dactyl", {
|
|||||||
"Execute the argument as an Ex command",
|
"Execute the argument as an Ex command",
|
||||||
function (args) {
|
function (args) {
|
||||||
try {
|
try {
|
||||||
let cmd = dactyl.userEval(args.string);
|
let cmd = dactyl.userEval(args[0]);
|
||||||
dactyl.execute(cmd, null, true);
|
dactyl.execute(cmd, null, true);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dactyl.echoerr(e);
|
dactyl.echoerr(e);
|
||||||
}
|
}
|
||||||
});
|
}, { literal: 0 });
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -1736,15 +1736,17 @@ const Dactyl = Module("dactyl", {
|
|||||||
|
|
||||||
commands.add(["norm[al]"],
|
commands.add(["norm[al]"],
|
||||||
"Execute Normal mode commands",
|
"Execute Normal mode commands",
|
||||||
function (args) { events.feedkeys(args.string, args.bang); },
|
function (args) { events.feedkeys(args[0], args.bang); },
|
||||||
{
|
{
|
||||||
argCount: "+",
|
argCount: "+",
|
||||||
bang: true
|
bang: true,
|
||||||
|
literal: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.add(["optionu[sage]"],
|
commands.add(["optionu[sage]"],
|
||||||
"List all options with a short description",
|
"List all options with a short description",
|
||||||
function (args) { Dactyl.showHelpIndex("option-index", options, args.bang); }, {
|
function (args) { Dactyl.showHelpIndex("option-index", options, args.bang); },
|
||||||
|
{
|
||||||
argCount: "0",
|
argCount: "0",
|
||||||
bang: true
|
bang: true
|
||||||
});
|
});
|
||||||
@@ -1804,7 +1806,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
function (args) {
|
function (args) {
|
||||||
let count = args.count;
|
let count = args.count;
|
||||||
let special = args.bang;
|
let special = args.bang;
|
||||||
args = args.string;
|
args = args[0];
|
||||||
|
|
||||||
if (args[0] == ":")
|
if (args[0] == ":")
|
||||||
var method = function () dactyl.execute(args, null, true);
|
var method = function () dactyl.execute(args, null, true);
|
||||||
|
|||||||
@@ -1126,17 +1126,18 @@ const Events = Module("events", {
|
|||||||
commands.add(["delmac[ros]"],
|
commands.add(["delmac[ros]"],
|
||||||
"Delete macros",
|
"Delete macros",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.assert(!args.bang || !args.string, "E474: Invalid argument");
|
dactyl.assert(!args.bang || !args[0], "E474: Invalid argument");
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
events.deleteMacros();
|
events.deleteMacros();
|
||||||
else if (args.string)
|
else if (args[0])
|
||||||
events.deleteMacros(args.string);
|
events.deleteMacros(args[0]);
|
||||||
else
|
else
|
||||||
dactyl.echoerr("E471: Argument required");
|
dactyl.echoerr("E471: Argument required");
|
||||||
}, {
|
}, {
|
||||||
bang: true,
|
bang: true,
|
||||||
completer: function (context) completion.macro(context)
|
completer: function (context) completion.macro(context),
|
||||||
|
literal: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.add(["macros"],
|
commands.add(["macros"],
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ const Marks = Module("marks", {
|
|||||||
"Delete the specified marks",
|
"Delete the specified marks",
|
||||||
function (args) {
|
function (args) {
|
||||||
let special = args.bang;
|
let special = args.bang;
|
||||||
args = args.string;
|
args = args[0];
|
||||||
|
|
||||||
// assert(special ^ args)
|
// assert(special ^ args)
|
||||||
dactyl.assert( special || args, "E471: Argument required");
|
dactyl.assert( special || args, "E471: Argument required");
|
||||||
@@ -249,7 +249,8 @@ const Marks = Module("marks", {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
bang: true,
|
bang: true,
|
||||||
completer: function (context) completion.mark(context)
|
completer: function (context) completion.mark(context),
|
||||||
|
literal: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.add(["ma[rk]"],
|
commands.add(["ma[rk]"],
|
||||||
@@ -267,7 +268,7 @@ const Marks = Module("marks", {
|
|||||||
commands.add(["marks"],
|
commands.add(["marks"],
|
||||||
"Show all location marks of current web page",
|
"Show all location marks of current web page",
|
||||||
function (args) {
|
function (args) {
|
||||||
args = args.string;
|
args = args[0];
|
||||||
|
|
||||||
// ignore invalid mark characters unless there are no valid mark chars
|
// ignore invalid mark characters unless there are no valid mark chars
|
||||||
dactyl.assert(!args || /[a-zA-Z]/.test(args),
|
dactyl.assert(!args || /[a-zA-Z]/.test(args),
|
||||||
@@ -275,6 +276,8 @@ const Marks = Module("marks", {
|
|||||||
|
|
||||||
let filter = args.replace(/[^a-zA-Z]/g, "");
|
let filter = args.replace(/[^a-zA-Z]/g, "");
|
||||||
marks.list(filter);
|
marks.list(filter);
|
||||||
|
}, {
|
||||||
|
literal: 0
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1195,7 +1195,7 @@ const Options = Module("options", {
|
|||||||
commands.add(["let"],
|
commands.add(["let"],
|
||||||
"Set or list a variable",
|
"Set or list a variable",
|
||||||
function (args) {
|
function (args) {
|
||||||
args = args.string;
|
args = args[0];
|
||||||
|
|
||||||
if (!args) {
|
if (!args) {
|
||||||
let str =
|
let str =
|
||||||
|
|||||||
@@ -117,21 +117,22 @@ const QuickMarks = Module("quickmarks", {
|
|||||||
"Delete the specified QuickMarks",
|
"Delete the specified QuickMarks",
|
||||||
function (args) {
|
function (args) {
|
||||||
// TODO: finish arg parsing - we really need a proper way to do this. :)
|
// TODO: finish arg parsing - we really need a proper way to do this. :)
|
||||||
// assert(args.bang ^ args.string)
|
// assert(args.bang ^ args[0])
|
||||||
dactyl.assert( args.bang || args.string, "E471: Argument required");
|
dactyl.assert( args.bang || args[0], "E471: Argument required");
|
||||||
dactyl.assert(!args.bang || !args.string, "E474: Invalid argument");
|
dactyl.assert(!args.bang || !args[0], "E474: Invalid argument");
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
quickmarks.removeAll();
|
quickmarks.removeAll();
|
||||||
else
|
else
|
||||||
quickmarks.remove(args.string);
|
quickmarks.remove(args[0]);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
bang: true,
|
bang: true,
|
||||||
completer: function (context) {
|
completer: function (context) {
|
||||||
context.title = ["QuickMark", "URL"];
|
context.title = ["QuickMark", "URL"];
|
||||||
context.completions = this._qmarks;
|
context.completions = this._qmarks;
|
||||||
}
|
},
|
||||||
|
literal: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.add(["qma[rk]"],
|
commands.add(["qma[rk]"],
|
||||||
@@ -156,13 +157,15 @@ const QuickMarks = Module("quickmarks", {
|
|||||||
commands.add(["qmarks"],
|
commands.add(["qmarks"],
|
||||||
"Show all QuickMarks",
|
"Show all QuickMarks",
|
||||||
function (args) {
|
function (args) {
|
||||||
args = args.string;
|
args = args[0];
|
||||||
|
|
||||||
// ignore invalid qmark characters unless there are no valid qmark chars
|
// ignore invalid qmark characters unless there are no valid qmark chars
|
||||||
dactyl.assert(!args || /[a-zA-Z0-9]/.test(args), "E283: No QuickMarks matching " + args.quote());
|
dactyl.assert(!args || /[a-zA-Z0-9]/.test(args), "E283: No QuickMarks matching " + args.quote());
|
||||||
|
|
||||||
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
|
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
|
||||||
quickmarks.list(filter);
|
quickmarks.list(filter);
|
||||||
|
}, {
|
||||||
|
literal: 0
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
mappings: function () {
|
mappings: function () {
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ const Tabs = Module("tabs", {
|
|||||||
"Execute a command and tell it to output in a new tab",
|
"Execute a command and tell it to output in a new tab",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.forceNewTab = true;
|
dactyl.forceNewTab = true;
|
||||||
dactyl.execute(args.string, null, true);
|
dactyl.execute(args[0], null, true);
|
||||||
dactyl.forceNewTab = false;
|
dactyl.forceNewTab = false;
|
||||||
}, {
|
}, {
|
||||||
argCount: "+",
|
argCount: "+",
|
||||||
@@ -605,7 +605,7 @@ const Tabs = Module("tabs", {
|
|||||||
function (args) {
|
function (args) {
|
||||||
for (let i = 0; i < tabs.count; i++) {
|
for (let i = 0; i < tabs.count; i++) {
|
||||||
tabs.select(i);
|
tabs.select(i);
|
||||||
dactyl.execute(args.string, null, true);
|
dactyl.execute(args[0], null, true);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
@@ -756,7 +756,7 @@ const Tabs = Module("tabs", {
|
|||||||
commands.add(["tabopen", "t[open]", "tabnew"],
|
commands.add(["tabopen", "t[open]", "tabnew"],
|
||||||
"Open one or more URLs in a new tab",
|
"Open one or more URLs in a new tab",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.open(args.string || "about:blank", { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
|
dactyl.open(args[0] || "about:blank", { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
|
||||||
}, {
|
}, {
|
||||||
bang: true,
|
bang: true,
|
||||||
completer: function (context) completion.url(context),
|
completer: function (context) completion.url(context),
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ const Config = Module("config", ConfigBase, {
|
|||||||
"Execute a command and tell it to output in a new window",
|
"Execute a command and tell it to output in a new window",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.forceNewWindow = true;
|
dactyl.forceNewWindow = true;
|
||||||
dactyl.execute(args.string, null, true);
|
dactyl.execute(args[0], null, true);
|
||||||
dactyl.forceNewWindow = false;
|
dactyl.forceNewWindow = false;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -221,10 +221,8 @@ const Config = Module("config", ConfigBase, {
|
|||||||
commands.add(["wino[pen]", "wo[pen]"],
|
commands.add(["wino[pen]", "wo[pen]"],
|
||||||
"Open one or more URLs in a new window",
|
"Open one or more URLs in a new window",
|
||||||
function (args) {
|
function (args) {
|
||||||
args = args.string;
|
if (args[0])
|
||||||
|
dactyl.open(args[0], dactyl.NEW_WINDOW);
|
||||||
if (args)
|
|
||||||
dactyl.open(args, dactyl.NEW_WINDOW);
|
|
||||||
else
|
else
|
||||||
dactyl.open("about:blank", dactyl.NEW_WINDOW);
|
dactyl.open("about:blank", dactyl.NEW_WINDOW);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user