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

Add an "optional" tag to commands arguments' description when generating markdown docs #5158

Closed
adrianbenavides opened this issue Jun 21, 2023 · 4 comments · Fixed by #5163
Closed

Comments

@adrianbenavides
Copy link
Member

adrianbenavides commented Jun 21, 2023

Current behavior

Although there is an implicit differentiation between required/optional args (<ARG> for required args and [ARG] for optional), but we can't assume every user knows that. This is done automatically when showing the --help in the terminal, but not in the markdown docs (all arguments are shown as <ARG>), which creates an inconsistency.

We need to improve the markdown docs generation to include that information more explicitly.

Desired behavior

Related to #5030 (they can be completed in parallel).

We should add a piece of text to optional arguments so the user can easily differentiate between required/optional arguments.

To do so, the markdown command must be updated as follows. In the generate_arg_markdown function, the value_name is always written as "`<{value_name}>`". This should be changed so that:

  • if arg.is_required_set() is true, print it as "`<{value_name}>`"
  • else, print it as "`[{value_name}]`, (optional)"
@adrianbenavides adrianbenavides changed the title Automatically add an "optional" tag to commands arguments' description when generating markdown docs Add an "optional" tag to commands arguments' description when generating markdown docs Jun 21, 2023
@Alef-gabriel
Copy link
Contributor

Hi @adrianbenavides, i can take this?

@adrianbenavides
Copy link
Member Author

@Alef-gabriel looks like @BradLewis already created a PR for this, sorry! I'll try to create more issues soon 🙏

@BradLewis
Copy link
Contributor

Ah sorry Alef, I didn't see that you had also commented on this. My bad!

@Alef-gabriel
Copy link
Contributor

@BradLewis No problem.

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

Successfully merging a pull request may close this issue.

3 participants