Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5730 from trufflesuite/subCMDHelp
Browse files Browse the repository at this point in the history
fix `truffle help db <subCommand>`
  • Loading branch information
lsqproduction committed Nov 23, 2022
2 parents ee9165c + 28f3d26 commit 2c68fb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions packages/core/lib/commands/db/meta.js
Expand Up @@ -7,7 +7,9 @@ const usage =
OS.EOL +
" Available sub-commands: " +
OS.EOL +
" serve \tStart the GraphQL server";
" serve \tStart the GraphQL server" +
OS.EOL +
" query \tQuery @truffle/db";

module.exports = {
command: "db",
Expand All @@ -18,18 +20,16 @@ module.exports = {
...serveCommand.run,
...serveCommand.meta
})
.command({
...queryCommand.run,
...queryCommand.meta
})
.demandCommand();
},

subCommands: {
serve: {
help: serveCommand.help,
description: serveCommand.meta
},
query: {
help: queryCommand.help,
description: queryCommand.meta
}
serve: serveCommand.meta,
query: queryCommand.meta
},

help: {
Expand Down
10 changes: 5 additions & 5 deletions packages/core/lib/commands/help/displayCommandHelp.js
Expand Up @@ -4,14 +4,14 @@ module.exports = async function (selectedCommand, subCommand, options) {

let commandHelp, commandDescription;

const chosenCommand = commands[selectedCommand];
const chosenCommand = commands[selectedCommand].meta;

if (subCommand && chosenCommand.subCommands[subCommand]) {
commandHelp = chosenCommand.subCommands[subCommand].meta.help;
commandDescription = chosenCommand.subCommands[subCommand].meta.description;
commandHelp = chosenCommand.subCommands[subCommand].help;
commandDescription = chosenCommand.subCommands[subCommand].description;
} else {
commandHelp = chosenCommand.meta.help;
commandDescription = chosenCommand.meta.description;
commandHelp = chosenCommand.help;
commandDescription = chosenCommand.description;
}

if (typeof commandHelp === "function") {
Expand Down

0 comments on commit 2c68fb1

Please sign in to comment.