dust icon indicating copy to clipboard operation
dust copied to clipboard

man page

Open ConorSheehan1 opened this issue 5 years ago • 10 comments

Awesome work!

Any chance of adding a man page? Maybe something like ripgrep has using asciidoc? https://github.com/BurntSushi/ripgrep/blob/7cbc535d70a53c81dfa3e58552c01f21c2e38d28/build.rs#L66

❯ man dust
No manual entry for dust

I see dust --help works, but it'd be handy to have a man page too, since it's many peoples first instinct when trying a new cli tool.

ConorSheehan1 avatar Dec 18 '19 18:12 ConorSheehan1

sounds good, if you want to open a PR I'll review it, otherwise I'll do it myself over the holidays.

bootandy avatar Dec 19 '19 09:12 bootandy

I'd like to help but I don't know much about rust or asciidoc. I'll give it a try over the holidays if you haven't gotten to it already.

ConorSheehan1 avatar Dec 19 '19 18:12 ConorSheehan1

Can't figure this out

It seems this is done by creating a task in 'build.rs' at the top level which is run when cargo install is run. There you can generate a man page (in asciidoc) using a tool like this one: https://crates.io/crates/man/0.1.0

But the only way I can see of getting the man page into the system is to then copy it to /usr/share/man/man1/ as part of the build step and that seems a bit intrusive. I looked at bat and fd and neither of those libraries seem to create man pages in build.rs and so I'm inclined to not do this.

Happy to include this if someone figures out a nice way to do it.

bootandy avatar Jan 14 '20 22:01 bootandy

No worries man, sorry I didn't get around to it! I underestimated the stuff I thought I'd get done over the holidays. If I get a chance I'll show it to some friends who know rust and see if we can crack it

ConorSheehan1 avatar Jan 14 '20 22:01 ConorSheehan1

Should look at this again when this issue is resolved: https://github.com/rust-lang/cargo/issues/2729

bootandy avatar Jan 15 '20 10:01 bootandy

I think a manpage would be a great addition to the software. Until the issue mentioned above is resolved, perhaps this could be done similarly to how Alacritty does it? The manpage and other extras aren't installed by cargo, but they are included in the source code, and can be easily installed manually to /usr/local/share/man/man1 for those who want them.

acheam0 avatar Jan 17 '21 22:01 acheam0

Can't figure this out

It seems this is done by creating a task in 'build.rs' at the top level which is run when cargo install is run. There you can generate a man page (in asciidoc) using a tool like this one: https://crates.io/crates/man/0.1.0 Happy to include this if someone figures out a nice way to do it.

Note the comments here about using build.rs

https://users.rust-lang.org/t/installing-data-files-assets-when-cargo-install-is-run/47690/2

For one of my projects, we decided to use a configure.ac and Makefile.in to handle the installation and uninstallation of the extra stuff that often accompanies a package:

https://github.com/TelluricDeckay/telluricdeckay/tree/feat/implement-ice

I did that based on this HowTo

andy5995 avatar Jan 17 '21 22:01 andy5995

the man page would be great if anyone can work it out, this and the fewer options compared to du are the only thinks keeping me from using it

crypticC0der avatar Feb 20 '21 16:02 crypticC0der

Homebrew's ripgrep formula installs the man page from the build dir using man1.install:

# Completion scripts and manpage are generated in the crate's build
# directory, which includes a fingerprint hash. Try to locate it first
out_dir = Dir["target/release/build/ripgrep-*/out"].first
man1.install "#{out_dir}/rg.1"

cherryblossom000 avatar Jul 13 '21 22:07 cherryblossom000

New clap crate implies it will give us this for free! https://rust-cli.github.io/book/in-depth/docs.html

bootandy avatar Jul 19 '21 13:07 bootandy

I use man in my project to generate a man page from build.rs : https://github.com/cortex/ripasso/blob/master/cursive/build.rs#L3

I have also seen https://crates.io/crates/clap_mangen being used, I need a man page in order to package this for Debian, I could also send it in as a PR if you have any opinion on which method you prefer?

alexanderkjall avatar Jan 27 '23 16:01 alexanderkjall