mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 20:22:00 +00:00
Bug 761268 - GCLI has hard-coded strings; r=dcamp
This commit is contained in:
parent
3b9ea57631
commit
20562fa05e
@ -7920,9 +7920,39 @@ help.shutdown = function() {
|
||||
* Create a block of data suitable to be passed to the help_list.html template
|
||||
*/
|
||||
function getListTemplateData(args, context) {
|
||||
var matchingCommands = canon.getCommands().filter(function(command) {
|
||||
if (command.hidden) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.search && command.name.indexOf(args.search) !== 0) {
|
||||
// Filtered out because they don't match the search
|
||||
return false;
|
||||
}
|
||||
if (!args.search && command.name.indexOf(' ') != -1) {
|
||||
// We don't show sub commands with plain 'help'
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
matchingCommands.sort();
|
||||
|
||||
var heading;
|
||||
if (matchingCommands.length === 0) {
|
||||
heading = l10n.lookupFormat('helpListNone', [ args.search ]);
|
||||
}
|
||||
else if (args.search == null) {
|
||||
heading = l10n.lookup('helpListAll');
|
||||
}
|
||||
else {
|
||||
heading = l10n.lookupFormat('helpListPrefix', [ args.search ]);
|
||||
}
|
||||
|
||||
return {
|
||||
l10n: l10n.propertyLookup,
|
||||
includeIntro: args.search == null,
|
||||
matchingCommands: matchingCommands,
|
||||
heading: heading,
|
||||
|
||||
onclick: function(ev) {
|
||||
util.updateCommand(ev.currentTarget, context);
|
||||
@ -7931,32 +7961,6 @@ function getListTemplateData(args, context) {
|
||||
ondblclick: function(ev) {
|
||||
util.executeCommand(ev.currentTarget, context);
|
||||
},
|
||||
|
||||
getHeading: function() {
|
||||
return args.search == null ?
|
||||
'Available Commands:' :
|
||||
'Commands starting with \'' + args.search + '\':';
|
||||
},
|
||||
|
||||
getMatchingCommands: function() {
|
||||
var matching = canon.getCommands().filter(function(command) {
|
||||
if (command.hidden) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.search && command.name.indexOf(args.search) !== 0) {
|
||||
// Filtered out because they don't match the search
|
||||
return false;
|
||||
}
|
||||
if (!args.search && command.name.indexOf(' ') != -1) {
|
||||
// We don't show sub commands with plain 'help'
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
matching.sort();
|
||||
return matching;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -7986,10 +7990,10 @@ function getManTemplateData(command, context) {
|
||||
getTypeDescription: function(param) {
|
||||
var input = '';
|
||||
if (param.defaultValue === undefined) {
|
||||
input = 'required';
|
||||
input = l10n.lookup('helpManRequired');
|
||||
}
|
||||
else if (param.defaultValue === null) {
|
||||
input = 'optional';
|
||||
input = l10n.lookup('helpManOptional');
|
||||
}
|
||||
else {
|
||||
input = param.defaultValue;
|
||||
@ -8066,10 +8070,10 @@ define("text!gcli/commands/help_man.html", [], "\n" +
|
||||
|
||||
define("text!gcli/commands/help_list.html", [], "\n" +
|
||||
"<div>\n" +
|
||||
" <h3>${getHeading()}</h3>\n" +
|
||||
" <h3>${heading}</h3>\n" +
|
||||
"\n" +
|
||||
" <table>\n" +
|
||||
" <tr foreach=\"command in ${getMatchingCommands()}\"\n" +
|
||||
" <tr foreach=\"command in ${matchingCommands}\"\n" +
|
||||
" onclick=\"${onclick}\" ondblclick=\"${ondblclick}\">\n" +
|
||||
" <th class=\"gcli-help-name\">${command.name}</th>\n" +
|
||||
" <td class=\"gcli-help-arrow\">-</td>\n" +
|
||||
|
@ -2015,7 +2015,7 @@ define('gclitest/testHelp', ['require', 'exports', 'module' , 'gclitest/helpers'
|
||||
helpers.exec(options, {
|
||||
typed: 'help nomatch',
|
||||
args: { search: 'nomatch' },
|
||||
outputMatch: /Commands starting with 'nomatch':$/
|
||||
outputMatch: /No commands starting with 'nomatch'$/
|
||||
});
|
||||
|
||||
helpers.exec(options, {
|
||||
@ -2031,7 +2031,7 @@ define('gclitest/testHelp', ['require', 'exports', 'module' , 'gclitest/helpers'
|
||||
helpers.exec(options, {
|
||||
typed: 'help a b',
|
||||
args: { search: 'a b' },
|
||||
outputMatch: /Commands starting with 'a b':$/
|
||||
outputMatch: /No commands starting with 'a b'$/
|
||||
});
|
||||
|
||||
helpers.exec(options, {
|
||||
|
@ -137,6 +137,28 @@ helpManParameters=Parameters
|
||||
# heading in a help page for a command which has no parameters.
|
||||
helpManNone=None
|
||||
|
||||
# LOCALIZATION NOTE (helpListAll): The heading shown in response to the 'help'
|
||||
# command when used without a filter, just above the list of known commands.
|
||||
helpListAll=Available Commands:
|
||||
|
||||
# LOCALIZATION NOTE (helpListPrefix): The heading shown in response to the
|
||||
# 'help <search>' command (i.e. with a search string), just above the list of
|
||||
# matching commands.
|
||||
helpListPrefix=Commands starting with '%1$S':
|
||||
|
||||
# LOCALIZATION NOTE (helpListNone): The heading shown in response to the 'help
|
||||
# <search>' command (i.e. with a search string), when there are no matching
|
||||
# commands.
|
||||
helpListNone=No commands starting with '%1$S'
|
||||
|
||||
# LOCALIZATION NOTE (helpManRequired): When the 'help x' command wants to show
|
||||
# the manual for the 'x' command it needs to be able to describe the
|
||||
# parameters as either required or optional. See also 'helpManOptional'.
|
||||
helpManRequired=required
|
||||
|
||||
# LOCALIZATION NOTE (helpManOptional): See description of 'helpManRequired'
|
||||
helpManOptional=optional
|
||||
|
||||
# LOCALIZATION NOTE (subCommands): Text shown as part of the output of the
|
||||
# 'help' command when the command in question has sub-commands, before a list
|
||||
# of the matching sub-commands
|
||||
|
Loading…
x
Reference in New Issue
Block a user