mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
Issue #845 -- show options for each command
This commit is contained in:
parent
684a2b9ca8
commit
3663e24975
1 changed files with 17 additions and 0 deletions
|
@ -115,6 +115,20 @@ var instantCommands = [
|
|||
}],
|
||||
[/^show +commands$/, function(bits) {
|
||||
var allCommands = getAllCommands();
|
||||
var allOptions = Commands.commands.getOptionMap();
|
||||
var commandToOptions = {};
|
||||
|
||||
Object.keys(allOptions).forEach(function(vcs) {
|
||||
var vcsMap = allOptions[vcs];
|
||||
Object.keys(vcsMap).forEach(function(method) {
|
||||
var options = vcsMap[method];
|
||||
if (options) {
|
||||
commandToOptions[vcs + ' ' + method] = Object.keys(options).filter(option => option.length > 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var lines = [
|
||||
intl.str('show-all-commands'),
|
||||
'<br/>'
|
||||
|
@ -122,6 +136,9 @@ var instantCommands = [
|
|||
Object.keys(allCommands)
|
||||
.forEach(function(command) {
|
||||
lines.push(command);
|
||||
if (commandToOptions[command]) {
|
||||
commandToOptions[command].forEach(option => lines.push(' ' + option));
|
||||
}
|
||||
});
|
||||
|
||||
throw new CommandResult({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue