[haiku] Re: Documenting your package

  • From: Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Wed, 6 Apr 2016 18:57:40 -0700

On Wed, Apr 06, 2016 at 10:00:19AM +0200, clasqm wrote:


Perhaps one could look at the approach taken here: http://bruji.com/bwana/ ;
this Mac OSX app translates man pages on-the-fly to HTML and uses the browser 
to present the results. MIT licensed, but probably written in OBJ-C so it 
would be inspiration rather than a straight port.

Looks cute...  As I have no knowledge of Mac coding schemes, I don't
really understand much of what I loked at in the code, but I get the
idea that it generates normal man output, then converts *that* to html.

Just to be a bit silly (:-)), I set up a man/info front-end as a xicon script,
using my new "gadgeteer" command-line/GUI link app.
http://goodeveca.net/beos/#gadgeteer [It *is* a Haiku app...]) 
Just click on the script icon, then enter the appname in the text box
and select either the "Man" or "Info" buttons to bring up the doc.
You can drag an app file onto the icon instead, to get its name
into the box initially.

Here's the fairly short script:

#! /bin/sh

useOutput() {
  while true; do
        read NAME
        if [ $? != 0 ]; then
          return; fi
        read MAN
        read INFO
        if [ "$MAN" ]; then
         Terminal sh -c "if man $NAME; then true; else echo no man page for 
$NAME; read; fi"
         continue; fi
        if [ "$INFO" ]; then
         Terminal info $NAME
         continue; fi
  done
}

NAME=$(basename $1 2>/dev/null)
gadgeteer {width: 300, div: 60, title: Man Pages and Info, \
        textcontrol: {label: Name, init: $NAME}, \
        width: 50, pos: below 60, \
        button: Man, pos: right 50, button: Info, \
        done: } | useOutput


It should be given the mimetype "text/x-script.xicon-bg", so it
doesn't open a redundant Terminal.

Just thought it was a fun thing to try...


Looking at the 'man' and 'info' trees, though, they don't seem entirely
in good shape.  For instance 'man' has 'man1',  'man3', and so on as it
should, but things like 'zip.1' are at the top level, so "man zip" finds
nothing!  I guess some packages need to be fixed.

I'm not sure how 'info' is supposed to be organized, but just typing "info"
indicates there's supposed to be an index page.  The only thing there
is "Wget".  (Hmm, I guess package management makes having an index
a bit difficult.  It would have to be built on the fly.)

        -- Pete --

Other related posts: