Skip to content
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

Positional describe not shown in help message unless defined at top level with commandDir #2239

Closed
KoenDG opened this issue Sep 25, 2022 · 3 comments

Comments

@KoenDG
Copy link

KoenDG commented Sep 25, 2022

I'm using a commandDir(), as described here: https://github.com/yargs/yargs/blob/main/docs/advanced.md

My layout is similar to the one in the example:

myapp/
├─ cli.js
└─ cmds/
   ├─ init.js
   ├─ remote.js
   └─ remote_cmds/
      ├─ add.js
      └─ prune.js

With this example, say I've got a positional argument in add.js, at the most bottom level.

I filled in the builder export, gave it a description, in order to show the help message for it. But it doesn't show up.

It does show up if I move that description to the builder export of remote.js, one level above it.

Since the argument only makes sense in context of add.js, that's where I added the description. But it only shows up if added the level above it.

Is this expected? Am I misunderstanding something? Or did I stumble across a bug?

@shadowspawn
Copy link
Member

Have you got an example program or repo?
What help command are you running that shows the problem?

@KoenDG
Copy link
Author

KoenDG commented Jul 19, 2023

Ok, I wrote an example for this and in doing so figured out what I was doing wrong.

I added an optional parameter and expected it to be universal. That is to say: by adding it at an intermediate level, have it be available at all lower levels. But that's not a reasonable assumption, it has to be define in the final form of the command.

The example I wrote: https://github.com/KoenDG/exmple_yargs/tree/main

@KoenDG KoenDG closed this as completed Jul 19, 2023
@shadowspawn
Copy link
Member

Thanks for taking another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants