Page 1 of 1

Solution for my manpage crysis

Posted: 16 Apr 2011, 20:48
by 82issa
man oh man

Code: Select all

man man
Under the Name it says
man - format and display the on-line manual pages
I might be blind or dumb. But I have not been able to figure out how to get the on-line manual pages. I have plugged away for a while and have come to a couple conclusions.

The first is a really small shell script. named "oman" get it o-man no no I think you are not getting it. It is short for online manual.

Code: Select all

#! /bin/bash
lynx http://man.cx/$1
I know, I know. Your not using the actual man pages. Its just sweet and simple. I just move it to my bin directory.

So I (brain stormed) a little more. And realized how much time to people spend actually needing to craw through hundreds of man pages. Almost none.
What if there was a NFS mounted to whatever and we just add that to the $MANPATH It only needs to be read-only. And could be easily added to live distro. With access to many many more man pages than your system might hold.

Re: Solution for my manpage crysis

Posted: 17 Apr 2011, 21:54
by fanthom
nice idea but i see one problem:
it wont work without internet access.

i'm voting on man pages included in distro :)

Re: Solution for my manpage crysis

Posted: 18 Apr 2011, 12:44
by 82issa
Well I think it would still work. Seamlessly without to many people noticing. If we did a NFS repo with all those manpages.

Re: Solution for my manpage crysis

Posted: 19 Apr 2011, 11:32
by lo-n-behold
why not ship a minimal amount of man-pages
and add a separate module "manpages" for offline users
and add your "oman" script too

cat /usr/local/bin/man

Code: Select all

#!/usr/bin/bash
/usr/bin/man $*
if [ $? ]; then lynx http://man.cx/$1; fi

btw, the expression "online manpages" dates from before the internet,
it means that they are on your computer (i.e. on-line), instead of on paper in the cupboard (i.e. off-line)

Re: Solution for my manpage crysis

Posted: 19 Apr 2011, 13:12
by 82issa
I just cant believe that they would not update their man manpage. Very sexy code tho.
I will be changing my oman code during lunch break.

Re: Solution for my manpage crysis

Posted: 19 Apr 2011, 15:39
by fanthom
@lo-n-behold and 82issa
man pages are well compressed by 'xz' (and lzma too) - they really takes only minimal space in the ISO. i would leave them in place.
anyway, i like the idea of using 'lynx' when man page is missing.
your script will be added to next Porteus release.

Thanks a lot guys :)

EDIT:\\
rewritten the code and improved a bit:

Code: Select all

#!/bin/sh

if [ "$1" = "" ]; then echo "What manual page do you want?"; exit; fi
/usr/bin/man $* || for x in $*; do lynx http://man.cx/$x; done
otherwise man page for existing manuals would be opened twice (one from local and one from remote repository)

Cheers

Re: Solution for my manpage crysis

Posted: 19 Apr 2011, 16:22
by 82issa
I like the revision of the code @ fanthom. Great work all around. I only see
one potential problems. I don't know how long http://man.cx will be arround
their page extension works perfectly for our scripts. Maybe in future we will
have something a little more solid. For now excellent solution. Thanks for both
of your efforts and input @lo-n-behold and fanthom.

Edit:
And one more thing. Do you guys think /usr/local/bin/man the best path for this?

Re: Solution for my manpage crysis

Posted: 19 Apr 2011, 16:43
by fanthom
@82issa
yes - /usr/local/bin is before /usr/bin
check "echo $PATH"

(scripts and binaries added by user are prioritized)

Re: Solution for my manpage crysis

Posted: 19 Apr 2011, 16:49
by 82issa
Good stuff I was not aware of that.