debiman icon indicating copy to clipboard operation
debiman copied to clipboard

programmatically query manpage details

Open lnxbil opened this issue 7 years ago • 6 comments

Hi,

is there a way to query a raw manpage directly only by its (unambiguous) name? I want to use it from the CLI.

Best, Andreas

lnxbil avatar Jan 23 '17 21:01 lnxbil

Yes: for every .html file, there is a corresponding .gz file containing the raw manpage. Hence, you can fetch e.g. https://manpages.debian.org/bash, which results in a temporary redirect to /jessie/bash/bash.1.en.html. Replace the html with gz, and you’ll get the raw manpage:

curl -s https://manpages.debian.org/jessie/bash/bash.1.en.gz | man /dev/stdin

Hope that helps!

stapelberg avatar Jan 23 '17 21:01 stapelberg

Thanks, that works ... should I open another issue for the ambiguous case?

lnxbil avatar Jan 23 '17 21:01 lnxbil

Not sure I follow. When things are ambiguous, what would you like to do?

stapelberg avatar Jan 23 '17 21:01 stapelberg

I'd like to get the same alternatives that are displayed right now, but in text form, e.g. a simple list wrapped in JSON or some other format. That should be discussed, but it would be a great feature to open all manpages through the debiman service from the commandline.

I use vimpager and your command does not provide a working sample for that. The manpage is just simple text as a block. I only got a command not working as a pipe, but with a temporary file:

wget -O /tmp/manpage -q https://manpages.debian.org/testing/zfsutils-linux/zfs.8.en.gz ; \
vim -c 'set ft=man' -c ':Man /tmp/manpage'

lnxbil avatar Jan 24 '17 06:01 lnxbil

Let me dwell on the best way to implement this feature for a little while. My current idea is to provide a .json file with everything we know about a manpage (i.e. we’ll have html, gz and json).

stapelberg avatar Jan 24 '17 08:01 stapelberg

Perfect!

lnxbil avatar Jan 24 '17 21:01 lnxbil