New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
middleware doesn't work as expected when used in isolation #1351
Comments
I just ran into this, and here is my feedback:
Right now I am doing the following: yargs()
.middleware(common)
.command('$0', 'default', {}, (argv) => {
common(argv)
// ...
})
function common (argv) {
// common mw
} This works, but it took me a bit to figure out why the middleware was not being run. I looked into submitting a PR, but I dont have time right now to fully learn this codebase :(. If I am pointed in the right direction I might be able to work it out, but at first read I was unsure where to make the change. |
@wesleytodd would very much appreciate help, I can at least point you at the right files when I have some cycles. |
@wesleytodd I tried to reproduce this issue with your code and master branch:
So I do not think there is something to correct here. |
When a default command is used, middleware works as expected on the latest release (Refs: #1813). I would like to make it so middleware is applied even if you don't specify a default command, perhaps we could refactor the codebase to always have a default command registered. |
Refs: #1823 |
middleware doesn't work as I'd expect for
yargs.argv
; I would expect the middlware runs, it does not.The text was updated successfully, but these errors were encountered: