mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:07:58 +01:00
always construct a default usage string for mappings and commands
This commit is contained in:
@@ -72,17 +72,15 @@ function Command(specs, action, extra_info) //{{{
|
|||||||
|
|
||||||
this.action = action;
|
this.action = action;
|
||||||
|
|
||||||
|
// TODO: build a better default usage string
|
||||||
|
this.usage = this.specs;
|
||||||
|
|
||||||
if (extra_info)
|
if (extra_info)
|
||||||
{
|
{
|
||||||
//var flags = extra_info.flags || 0;
|
//var flags = extra_info.flags || 0;
|
||||||
|
|
||||||
if (extra_info.usage)
|
if (extra_info.usage)
|
||||||
this.usage = extra_info.usage;
|
this.usage = extra_info.usage;
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: build a default usage string -- djk
|
|
||||||
this.usage = this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.help = extra_info.help || null;
|
this.help = extra_info.help || null;
|
||||||
this.short_help = extra_info.short_help || null;
|
this.short_help = extra_info.short_help || null;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ function Map(mode, cmds, act, extra_info) //{{{
|
|||||||
this.names = cmds;
|
this.names = cmds;
|
||||||
this.action = act;
|
this.action = act;
|
||||||
|
|
||||||
|
this.usage = [this.names[0]];
|
||||||
|
|
||||||
if (extra_info)
|
if (extra_info)
|
||||||
{
|
{
|
||||||
this.flags = extra_info.flags || 0;
|
this.flags = extra_info.flags || 0;
|
||||||
@@ -43,10 +45,9 @@ function Map(mode, cmds, act, extra_info) //{{{
|
|||||||
this.usage = extra_info.usage;
|
this.usage = extra_info.usage;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.usage = "";
|
this.usage = this.names[0]; // only the first command name
|
||||||
if (this.flags & Mappings.flags.COUNT)
|
if (this.flags & Mappings.flags.COUNT)
|
||||||
this.usage = "{count}";
|
this.usage = "{count}" + this.usage;
|
||||||
this.usage += this.names[0]; // only the first command name
|
|
||||||
if (this.flags & Mappings.flags.ARGUMENT)
|
if (this.flags & Mappings.flags.ARGUMENT)
|
||||||
this.usage += " {arg}";
|
this.usage += " {arg}";
|
||||||
this.usage = [this.usage]; // FIXME: usage an array - needed for the help
|
this.usage = [this.usage]; // FIXME: usage an array - needed for the help
|
||||||
@@ -54,6 +55,7 @@ function Map(mode, cmds, act, extra_info) //{{{
|
|||||||
|
|
||||||
this.help = extra_info.help || null;
|
this.help = extra_info.help || null;
|
||||||
this.short_help = extra_info.short_help || null;
|
this.short_help = extra_info.short_help || null;
|
||||||
|
|
||||||
// TODO: are these limited to HINTS mode?
|
// TODO: are these limited to HINTS mode?
|
||||||
// Only set for hints maps
|
// Only set for hints maps
|
||||||
this.cancel_mode = extra_info.cancel_mode || false;
|
this.cancel_mode = extra_info.cancel_mode || false;
|
||||||
|
|||||||
Reference in New Issue
Block a user