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

Allow options to contain multiple words #60

Merged
merged 1 commit into from
Sep 18, 2023
Merged

Conversation

Hnasar
Copy link
Contributor

@Hnasar Hnasar commented Aug 30, 2022

This PR is based on and supersedes the one in #44. I added more explanation, a test, and fixed a small bug with trailing whitespace.


When documenting subcommands, sometimes mkdocs-click will only show the
subcommand name. :prog_name: seems to be the right option to ensure
the actuall command is shown, but due to an overly-strict regex, it
used to ignore everything after the first whitespace. With this change,
prog_name and other commands can contain multiple words in their
values.

For example

::: mkdocs-click
    :module: foo.utils.bridge
    :prog_name: foo-utils bridge
    :command: cli

now properly renders as

foo-utils bridge [OPTIONS]

instead of

foo-utils [OPTIONS]

or

bridge [OPTIONS]

(^^ if prog_name wasn't specified at all)

Co-Authored-By: Bar Hochman bhochman@paloaltonetworks.com

@Hnasar Hnasar force-pushed the master branch 2 times, most recently from c09ec97 to 2a6ea83 Compare August 31, 2022 15:06
When documenting subcommands, sometimes mkdocs-click will only show the
subcommand name. `:prog_name:` seems to be the right option to ensure
the actuall command is shown, but due to an overly-strict regex, it
used to ignore everything after the first whitespace. With this change,
`prog_name` and other commands can contain multiple words in their
values.

For example

```
::: mkdocs-click
    :module: foo.utils.bridge
    :prog_name: foo-utils bridge
    :command: cli
```

now properly renders as

> foo-utils bridge [OPTIONS]

instead of

> foo-utils [OPTIONS]

or

> bridge [OPTIONS]

(^^ if prog_name wasn't specified at all)

Co-Authored-By: Bar Hochman <bhochman@paloaltonetworks.com>

Fixes mkdocs#42
Copy link
Contributor

@oprypin oprypin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@oprypin oprypin merged commit 57e64a5 into mkdocs:master Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-command modules not display correctly
2 participants