-
-
Notifications
You must be signed in to change notification settings - Fork 577
improved task middleware to show skipped path #1380
improved task middleware to show skipped path #1380
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! Just a few cosmetic suggestions
grifts.go
Outdated
} | ||
s = strings.Replace(s, "\n", "\n ", -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s = strings.Replace(s, "\n", "\n ", -1) | |
s = strings.Replace(s, "\n", "\n\t", -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I agree with using tab even though it takes five more spaces and can generate line wrap on 80 col terminal like me, anyway that is fancier!
grifts.go
Outdated
} | ||
s = strings.Replace(s, "\n", "\n ", -1) | ||
fmt.Printf(" %v\n", strings.TrimSpace(s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf(" %v\n", strings.TrimSpace(s)) | |
fmt.Printf("\t%v\n", strings.TrimSpace(s)) |
grifts.go
Outdated
fmt.Printf("-> %s\n", r.App.Name) | ||
printMiddlewareStackWithIndent(mws[r.App.Name]) | ||
} else { | ||
fmt.Printf("-> %s has same middleware stack as %v\n", r.App.Name, pname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("-> %s has same middleware stack as %v\n", r.App.Name, pname) | |
fmt.Printf("-> %s (see: %v)\n", r.App.Name, pname) |
Anyway, I found a bug, in case of the handler I will fix it as soon as possible, so please wait an hour! :-) |
Awesome. Let me know when it’s ready to go. |
OK, two commits for suggestion and bugfix are pushed and checked for CIs. |
Hi @markbates, |
So good! Thank you! |
You're welcome! |
* improved task middleware to show skipped path * use tab instead of spaces for indenting middlewares * fixed duplicated and invalid output for two or more skipping
Hi, as described as issue #1379, command
buffalo task middleware
does just show middleware stacks perApp
registered withApp.Group()
orApp.Resource()
and we cannot find which middleware was skipped (byApp.Middleware.Skip()
) in specific paths.By following routes and check related app, this commit allows user can find which is real middleware stack for each path. Example output is like this:
For handler which has skipped middleware, it shows like this:
Stack output format is same as normal
App
but the title line contains method and handler name.When there is no middleware for some handler or
App
, byClear()
, it shows "[none]".In case of the
App
that have same middleware stack as its parent, it shows like this:-> /api/v1/app/users has same middleware stack as /api/v1
Please check this patch.