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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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

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 <stephen@that.guru>
Signed-off-by: Stephen Finucane <stephen@that.guru>
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 <stephen@that.guru>
The tests now rely on the package being installed. Do that by using tox
to run our tests in Travis, like we do locally.

Signed-off-by: Stephen Finucane <stephen@that.guru>
@stephenfin
Copy link
Member Author

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

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
1 participant