click-contrib / click-man

Automate generation of man pages for python click applications :star:
MIT License
163 stars 35 forks source link

Add '--man-version', '--man-date' parameters #40

Open stephenfin opened 4 years ago

stephenfin commented 4 years ago

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 commented 2 years ago

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