mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 13:42:27 +01:00
Emit completion messages for arg parser errors.
This commit is contained in:
@@ -491,6 +491,14 @@ function Commands() //{{{
|
|||||||
args.completeArg = 0;
|
args.completeArg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function echoerr(error)
|
||||||
|
{
|
||||||
|
if (complete)
|
||||||
|
complete.message = error;
|
||||||
|
else
|
||||||
|
liberator.echoerr(error);
|
||||||
|
}
|
||||||
|
|
||||||
outer:
|
outer:
|
||||||
while (i < str.length || complete)
|
while (i < str.length || complete)
|
||||||
{
|
{
|
||||||
@@ -565,13 +573,11 @@ function Commands() //{{{
|
|||||||
arg = type.parse(arg);
|
arg = type.parse(arg);
|
||||||
if (arg == null || arg == NaN)
|
if (arg == null || arg == NaN)
|
||||||
{
|
{
|
||||||
|
echoerr("Invalid argument for " + type.description + "option: " + optname);
|
||||||
if (complete)
|
if (complete)
|
||||||
complete.highlight(args.completeStart, count - 1, "SPELLCHECK");
|
complete.highlight(args.completeStart, count - 1, "SPELLCHECK");
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.echoerr("Invalid argument for " + type.description + "option: " + optname);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,13 +586,11 @@ function Commands() //{{{
|
|||||||
{
|
{
|
||||||
if (opt[2].call(this, arg) == false)
|
if (opt[2].call(this, arg) == false)
|
||||||
{
|
{
|
||||||
|
echoerr("Invalid argument for option: " + optname);
|
||||||
if (complete)
|
if (complete)
|
||||||
complete.highlight(args.completeStart, count - 1, "SPELLCHECK");
|
complete.highlight(args.completeStart, count - 1, "SPELLCHECK");
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.echoerr("Invalid argument for option: " + optname);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,8 +682,7 @@ function Commands() //{{{
|
|||||||
else if (args.length == 1 && (argCount == "0") ||
|
else if (args.length == 1 && (argCount == "0") ||
|
||||||
args.length > 1 && /^[01?]$/.test(argCount))
|
args.length > 1 && /^[01?]$/.test(argCount))
|
||||||
{
|
{
|
||||||
if (!complete)
|
echoerr("E488: Trailing characters");
|
||||||
liberator.echoerr("E488: Trailing characters");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -355,7 +355,8 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
commands.add(["loadplugins", "lpl"],
|
commands.add(["loadplugins", "lpl"],
|
||||||
"Load all plugins immediately",
|
"Load all plugins immediately",
|
||||||
function () { liberator.loadPlugins(); });
|
function () { liberator.loadPlugins(); },
|
||||||
|
{ argCount: "0" );
|
||||||
|
|
||||||
commands.add(["norm[al]"],
|
commands.add(["norm[al]"],
|
||||||
"Execute Normal mode commands",
|
"Execute Normal mode commands",
|
||||||
|
|||||||
Reference in New Issue
Block a user