Open toshi0383 opened 6 years ago
Man-pages aren't really a standard among Swift command line tools. Many just rely on the help generators of various CLI libraries. For that reason I don't quite see the need to build something like this into Mint. If you have some evidence otherwise though, and are happy to open PR be my guest 😄
Mint is primarily designed to easily install Swift Package Manager command line tools. If a tool has extra resources, tools, or mechanisms around it, which are outside of Swift PM, they should probably find another way to distribute their tool.
IMO, Swift CLI community should adapt to man-page distribution already. There is a man-page for swift, too. We can say that man-page is a standard. I think a lot of terminal users expect a CLI tool to have corresponding man-page.
Many just rely on the help generators of various CLI libraries.
Yea I used to rely on help generator of Commander too, but I've quit it because I wanted to distribute more descriptive and readable documentation page to terminal users. I think the help generators are useful for short help pages, but not for detailed documentations.
If a tool has extra resources, tools, or mechanisms around it, which are outside of Swift PM, they should probably find another way to distribute their tool.
So currently Mint provides Package.resources
support outside of Swift PM. I guess it makes sense to support man-page, too.
My use case is my tool cmdshelf
. It spawns $PAGER
to show man-pages instead of help message by default.
https://github.com/toshi0383/cmdshelf/blob/master/Sources/cmdshelf/Commands.swift#L120
If user used Mint to install, then currently user would see nothing for help
command.
Anyways, I'm going to work on this feature. 👌
Looks like Cargo is going to support manpages as well. https://github.com/rust-lang/cargo/issues/2729
They have on-going rfc proposal for this and looks like the format is going to be install.rs
to be executed for arbitrary purpose (including copying manpages and so on).
For us, I propose a roadmap below. Each can be released separately.
FYI: Just found out that Rust community has a library which is just like Commander
, but even generates man-pages automatically.
https://github.com/clap-rs/clap
Mint could support installing man-pages.
To support this,
mint install
need todocs/man
to install man-pages.cp -Rf docs/man /usr/local/share/
or just symlink.SeeAlso: