We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When a middleware is defined to be run before validation, it appears that it is called multiple times.
See example in this stackblitz by running node index.js not-test test in the terminal.
node index.js not-test test
It looks like this has been brought up before in different ways and solved, but it appears that it is till occuring.
The text was updated successfully, but these errors were encountered:
Thanks for the example code. In case it becomes unavailable:
const yargs = require('yargs'); const CommandModule = { builder: (argv) => { argv.middleware(async () => { console.log('command middleware'); }, true); }, handler: () => { console.log('command'); }, command: 'test', }; function buildParser(localYargs) { return localYargs.command(CommandModule); } yargs() .middleware(async () => { console.log('global middleware'); }, true) .command('not-test', false, buildParser) .parse(process.argv.slice(2), () => { console.log('complete'); });
~/projects/node-t7j85c ❯ node index.js not-test test global middleware command middleware command global middleware command middleware complete
Sorry, something went wrong.
Related: #1802 #1966 #1978
(Reproduced with example code using Yargs v17.7.2.)
No branches or pull requests
When a middleware is defined to be run before validation, it appears that it is called multiple times.
See example in this stackblitz by running
node index.js not-test test
in the terminal.It looks like this has been brought up before in different ways and solved, but it appears that it is till occuring.
The text was updated successfully, but these errors were encountered: