1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 18:54:10 +01:00

add :optionusage command

This commit is contained in:
Doug Kearns
2008-10-04 16:45:16 +00:00
parent 7275233327
commit 7cd9f28279
4 changed files with 44 additions and 6 deletions

View File

@@ -349,6 +349,34 @@ const liberator = (function () //{{{
bangAllowed: true
});
liberator.commands.add(["optionu[sage]"],
"List all options with a short description",
function (args, special)
{
if (!special)
{
liberator.help("option-index");
}
else
{
// TODO: clicking on these should open the help
var usage = <table>
{
liberator.template.map(liberator.options, function (option)
<tr>
<td class="hl-Title" style="padding-right: 20px">{option.name}</td>
<td>{option.description}</td>
</tr>)
}
</table>;
liberator.echo(usage, liberator.commandline.FORCE_MULTILINE);
}
},
{
argCount: "0",
bangAllowed: true
});
liberator.commands.add(["q[uit]"],
liberator.has("tabs") ? "Quit current tab" : "Quit application",
function (args, special)

View File

@@ -862,8 +862,9 @@ liberator.Options = function () //{{{
__iterator__: function ()
{
for (let i = 0; i < options.length; i++)
yield options[i];
let sorted = options.sort(function (opt1, opt2) opt1.name > opt2.name);
for (let i = 0; i < sorted.length; i++)
yield sorted[i];
},
add: function (names, description, type, defaultValue, extraInfo)