wader / fq

jq for binary formats - tool, language and decoders for working with binary and text formats
Other
9.76k stars 227 forks source link

[Documentation] Any interest in creating a man page? #697

Open zarakshR opened 1 year ago

zarakshR commented 1 year ago

Would there be any interest in writing a man page for fq? I would love to help as far as possible.

wader commented 1 year ago

Hey! yes that would be nice and i've done some experiments how to do it but nothing complete or decided yet.

I just pushed https://github.com/wader/fq/pull/698 with one way of doing it. I guess it depends a bit what we want to have in the man page, list for formats? my idea with https://github.com/wader/fq/pull/698 is to try share most of the content between cli, documentation and man page so it's less work to maintain.

What do you think? any help is appreciated! i'm new to how to write good and compatible (linux and BSD) man pages, so that would be very helpful.

zarakshR commented 1 year ago

Hi! Sorry for the late reply, was caught up in school work.

The man(7) man-page lays out how to create man page for linux (I cannot run my FreeBSD system at the moment so not sure about how man works over there) The man command basically runs groff in the background with a special macro template called an and displays groff's output to the screen.

man(7) also lays out the basic structure required to define a man documentation page.

Here is a basic example of how it works. The window on the left is the source file which groff (called by man) processes into the output on the left.

I think I could write up a man source file pretty quickly, but where should I get the info from? Do I just get it from the README or do you have any other documentation source somehwere?

wader commented 1 year ago

Hey, no worries. As i noted in the comment above it would be nice to be able to share/generate part of the man page. Ideally i think i would like to generate the man page based on some sections from README.md and also generate support formats, options, env variables etc. In https://github.com/wader/fq/pull/698 i'm did a stab at having a jq script generate the man page, fq also has support for markdown so it should be possible to parser README.md and pick things out.

But maybe a first step could be to just have something static and start with that? maybe just copy text from README.md? that would help to have as base for for a script the generate.

zarakshR commented 1 year ago

OK. I am starting work on writing a static version of the man page. I'll use the README.md and the usage.md as a starting point, is that OK?

P.S. Maybe look into using m4, the macro processor, it would probably simplify dynamically generating different kinds of documentations/accreditation/upstream contact information/maintainers list/etc

wader commented 1 year ago

Sounds great 👍 can also sneak peak at the diff for https://github.com/wader/fq/pull/698