praiskup / argparse-manpage

Automatically build man-pages for your Python project
Apache License 2.0
40 stars 21 forks source link

Making output idempotent (date in first line) #75

Closed ssbarnea closed 1 year ago

ssbarnea commented 1 year ago

As I do want to track the output file with the repository, I need to make the output of the command idempotent. Still, I observed that a date is dumped in the first line, which would prevent doing that.

Would it be possible to avoid including this date or to at least allow a custom value for it? If the man page requires a date, we could likely get the date of the last tag from git, which should prevent the build from breaking between commits.

praiskup commented 1 year ago

Thank you for the idea. This sounds good! Having a --date option on top of that would be nice.

ssbarnea commented 1 year ago

Adding a data option would not be a big step in making the tool easier to call as we would need to run git log -1 --format="%at" or similar to get last commit date.

What do you think about calling git by default and using its last commit date by default instead of "now". If git is absent or fails, we can always fallback to now().

praiskup commented 1 year ago

In theory, if used with --pyfile, you could just reflect the history of the file. Otherwise, all you wrote sounds nice.

The --date can be added later (beating any heuristic we use by default).

bmwiedemann commented 1 year ago

Would #76 solve this issue for you?

ssbarnea commented 1 year ago

I think so, thanks!