Commander.js mutli word argument

387 Views Asked by At

I am creating a discord bot with NodeJs and I want to utilize the commander.js package to make the commands a bit more structured.

I want to declare a param to give a username, eq('-u, --user <USERNAME>', 'the user to handle'). This works great, until the username consists of more than 1 word. eq. John Doe. what happens is that after parsing the arguments I get a ('-u' == 'John') and I have a leftover argument array with the word 'Doe' in it.

I have tried passing the username between quotes. eqnode program -u "John Doe" but the result is the same.

Am I missing something or is commander.js not capable of handling multi word arguments?

1

There are 1 best solutions below

0
On

Turns out the args where wrongly splitted in another part of my bot. so this isn't an issue with either NodeJS or commander.js.

@Mods this question can be closed