You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am including version and date in the same issue because I've checked several man(1) pages and noticed that the formatting of the two is related: specifically, the version will be displayed in the bottom center of the page if the man page doesn't have a date. If the man page has a date, the date is displayed in the bottom center of the page and the version is moved to the left.
I also note that we can use the env!("CARGO_PACKAGE_VERSION") macro to read the version from the Cargo.toml file and that version is a required field. Based on the above, I propose the following API:
Default (nothing specified; assume the Cargo.toml version is 0.2.0)
Note: the API I suggest takes a str for the date and leaves the exact formatting to the user. It could, of course, take a date string or something (perhaps using Chrono) and format the date for the user. But, based on looking at a few man pages, there doesn't seem to be consensus on how to format dates and it seems better to leave that to the users.
Any thoughts on this API before I work on a PR?
The text was updated successfully, but these errors were encountered:
But, based on looking at a few man pages, there doesn't seem to be consensus on how to format dates and it seems better to leave that to the users.
I think it would be okay for us to be bold here and decide how to format it for people. I think this is something so minor that if people truly care about this they'll probably hand-roll their own pages.
It seems there's a good amount of options available, but if we look at kernel pages there seems to be a distinction between BSD and Linux:
We could go (slightly) overboard here, and use #[cfg] blocks to render the pages differently depending on which target it's compiled for. We should pick a default tho; either will probably work.
I also note that we can use the env!("CARGO_PACKAGE_VERSION") macro to read the version from the Cargo.toml file and that version is a required field.
Fun fact: if you call that macro from a dependency, the dependency's values are used instead of the main entry point's values. This means we'll have to make this an API.
I think the minimal API we could get away with would be:
I am including version and date in the same issue because I've checked several man(1) pages and noticed that the formatting of the two is related: specifically, the version will be displayed in the bottom center of the page if the man page doesn't have a date. If the man page has a date, the date is displayed in the bottom center of the page and the version is moved to the left.
I also note that we can use the env!("CARGO_PACKAGE_VERSION") macro to read the version from the Cargo.toml file and that version is a required field. Based on the above, I propose the following API:
Default (nothing specified; assume the Cargo.toml version is
0.2.0
)prints at the bottom:
Date
Date & Custom version
Custom date & no version
Note: the API I suggest takes a str for the date and leaves the exact formatting to the user. It could, of course, take a date string or something (perhaps using Chrono) and format the date for the user. But, based on looking at a few man pages, there doesn't seem to be consensus on how to format dates and it seems better to leave that to the users.
Any thoughts on this API before I work on a PR?
The text was updated successfully, but these errors were encountered: