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 '--man-version', '--man-date' parameters #40

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

stephenfin
Copy link
Member

@stephenfin stephenfin commented Apr 17, 2020

I store generated man pages in git. While auto-generated files generally aren't stored in version control, there are some advantages to this, chief among them being ease of packaging. Unfortunately, for projects that use something like setuptools-scm, there doesn't currently appear to be an easy way to generate these man pages ahead of time since the version information is retrieved from the dist.version attribute of the given command's EntryPoint. This means your generated man pages have versions like 1.2.3.dev4 when we want 1.2.4.

The solution is easy. Add a --man-version parameter (so named because --version is already taken), allowing you to configure this manually. For completeness, we also add a --man-date parameter, allowing you to configure the other dynamic property of these man pages. There are four steps necessary to achieve this:

  1. Move the main CLI functionality to a new module, click_man.shell, so it can be tested.
  2. Add tests for existing functionality
  3. Add the new functionality, along with tests
  4. Resolve issues with Travis, since the tests now expect the package to be installed

Resolves: #38

@stephenfin stephenfin force-pushed the reproducible-build branch from 16fca32 to 2b2c1b1 Compare July 1, 2022 11:44
@stephenfin
Copy link
Member Author

Rebased. Is anyone interested in this? I can abandon if not.

@timofurrer
Copy link
Member

I'm okay to iterate here. @stephenfin do you mind resolving the conflicts? (yes, a couple of years later, I had things to do 😅)

It's easier to test from here and avoids us having loads of code in a
dunder file. Some style fixups are included.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin
Copy link
Member Author

I'm okay to iterate here. @stephenfin do you mind resolving the conflicts? (yes, a couple of years later, I had things to do 😅)

That's done 👍

Signed-off-by: Stephen Finucane <[email protected]>
Provide a way to override the date and version used in generated man
pages. This can be useful where you want to generate man pages before
actually releasing something and don't want to manually edit them.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin
Copy link
Member Author

stephenfin commented Dec 11, 2024

Force push after (re-)enabling the CI.

@stephenfin stephenfin merged commit dafb144 into click-contrib:master Dec 11, 2024
5 checks passed
@stephenfin stephenfin deleted the reproducible-build branch December 11, 2024 13:10
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.

RFE: Be able to disable inclusion of date in generated manpage
2 participants