Skip to content

Commit

Permalink
fix: default help output is consisent with both --help flag
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jan 18, 2020
1 parent 7db04d7 commit fdf05cf
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 30 deletions.
83 changes: 64 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
},
"homepage": "https://github.com/adonisjs/adonis-framework#readme",
"devDependencies": {
"@adonisjs/ace": "^6.7.5",
"@adonisjs/ace": "^6.8.1",
"@adonisjs/assembler": "^1.2.7",
"@adonisjs/fold": "^6.2.3",
"@adonisjs/fold": "^6.3.0",
"@adonisjs/mrm-preset": "^2.2.3",
"@adonisjs/sink": "^2.4.3",
"@poppinss/dev-utils": "^1.0.3",
Expand Down
33 changes: 24 additions & 9 deletions src/Ignitor/Ace/AppCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ export class AppCommands {
) {
}

/**
* Print commands help
*/
private printHelp (kernel: adonisAce.Kernel, command?: any): never {
/**
* Updating manifest commands object during help
*/
Object.keys(this.additionalManifestCommands).forEach((commandName) => {
kernel.manifestCommands![commandName] = this.additionalManifestCommands[commandName]
})

kernel.printHelp(command)
process.exit(0)
}

/**
* Raises human friendly error when the `build` directory is
* missing during `generate:manifest` command.
Expand Down Expand Up @@ -95,15 +110,7 @@ export class AppCommands {
return
}

/**
* Updating manifest commands object during help
*/
Object.keys(this.additionalManifestCommands).forEach((commandName) => {
kernel.manifestCommands![commandName] = this.additionalManifestCommands[commandName]
})

kernel.printHelp(command)
process.exit(0)
this.printHelp(kernel, command)
}, { alias: 'h' })

/**
Expand Down Expand Up @@ -156,6 +163,14 @@ export class AppCommands {

kernel.useManifest(manifest)
await kernel.preloadManifest()

/**
* Print help when no arguments have been passed
*/
if (!argv.length) {
this.printHelp(kernel)
}

await kernel.handle(argv)

this.signalsListener.listen(async () => {
Expand Down

0 comments on commit fdf05cf

Please sign in to comment.