News for hackers. Stuff that matters.
Re:Simplified and community-driven man pages by kleiba on Sunday November 26, 2017 @07:47AM (#15780673)
De gustibus non est disputandum.

I've found javadocs enormously helpful when I was learning Java 20 years ago. But then again, I also like man pages and use them a lot.

If I'm looking for option "-e" of the test command, here's what I would do:

    $ man test
and then "/-e". Searching within a document is a commonly required skill in so many situations that I don't even think twice when applying it in man pages.

Of course, you could also just define a bash function for the functionality you're after like so:

    mano() {
        man "$1" | grep -A1 -- "$2"
    }
and then do

    $ mano test -e
or something along those lines.
Re:Simplified and community-driven man pages by jmfayard on Sunday November 26, 2017 @09:11AM (#15780953)
That's full text search, not having directly the argument definition. If you search "-l" in "man ls", it will be only your 8th occurence.
Re:Simplified and community-driven man pages by kleiba on Sunday November 26, 2017 @05:46PM (#15783526)
Sure, you're right, it's not the same thing. I just gave a simple example of something that's close, but I'm not even using a bash function like that myself. If I did, though, I guess the 8th occurrence wouldn't be so bad in my book, since the results can be scanned rather quickly.

You could always make your function more clever, e.g.:

    function mano() {
        man "$1" | grep -A1 -- "$2\\b"
    }
or

    function mano() {
        man "$1" | grep -A1 -- "$2  "
    }
but most probably, you will still run into edge cases that won't work properly. For instance, only one of the two versions above still works with "test -e".
Re:Simplified and community-driven man pages by nathyong on Sunday November 26, 2017 @05:53PM (#15783557)
You can actually search for ' -l' (two spaces in front) and abuse the man layout engine to find the point at which the flag itself is defined. Makes the man pages a lot more useful in my opinion.