Fix route CLI commands

This commit is contained in:
2022-01-20 00:54:55 -06:00
parent dc16dfdb81
commit 32050cb2ce
3 changed files with 84 additions and 24 deletions

View File

@@ -17,9 +17,14 @@ export class RoutesDirective extends Directive {
}
async handle(): Promise<void> {
/* const maxRouteLength = this.routing.getCompiled().max(route => String(route).length)
const maxHandlerLength = this.routing.getCompiled().max(route => route.getDisplayableHandler().length)
const rows = this.routing.getCompiled().map<[string, string]>(route => [String(route), route.getDisplayableHandler()])
const compiled = this.routing.getCompiled()
const maxRouteLength = compiled.strings().max('length')
const maxHandlerLength = compiled.mapCall('getHandlerDisplay')
.whereDefined()
.max('length')
const rows = compiled.map(route => [String(route), route.getHandlerDisplay()])
const table = new Table({
head: ['Route', 'Handler'],
@@ -28,6 +33,6 @@ export class RoutesDirective extends Directive {
table.push(...rows.toArray())
this.info('\n' + table)*/
this.info('\n' + table)
}
}