News for hackers. Stuff that matters.
Re:Um – Create your own man pages so you can remember how to... by gunnihinn on Monday August 20, 2018 @12:48AM (#17797794)
Make pandoc convert the txt/md/whatever to roff and pipe it to man, and you're pretty much there. It would also work on more than OSX, unlike um itself.
Re:Um – Create your own man pages so you can remember how to... by danieldk on Monday August 20, 2018 @01:23AM (#17797885)
Something like:

    umedit() { mkdir -p ~/notes; vim ~/notes/"$1.md" }
    um() { pandoc -s -t man ~/notes/"$1.md" | tbl | groff -Wall -mtty-char -man -Tascii -c | less -R }
Not sure if pandoc creates tbl tables ;).
Re:Um – Create your own man pages so you can remember how to... by zhann_dc on Monday August 20, 2018 @04:09AM (#17798373)
I went for:

    function mdless() {
      pandoc -s -f markdown -t man $1 | groff -T utf8 -man | less
    }
    umedit() { mkdir -p ~/.notes; vim ~/.notes/$1; }
    um() { mdless ~/.notes/"$1"; }
    umls() { ls ~/.notes }
This way I can write the notes in markdown and view them as such in `less`.
Re:Um – Create your own man pages so you can remember how to... by zaphodias on Monday August 20, 2018 @10:35AM (#17800214)
Great, thank you! I rewrote them for fish shell syntax and added the '-c' flag for `less` so it starts writing from the top of the window instead that from the bottom, I'm more confortable with it (still I don't know why it doesn't fit the terminal width like man does, but it wraps text every 80 characters - I guess it's not a problem anyway).

function mdless pandoc -s -f markdown -t man $argv[1] | groff -T utf8 -man | less -c end function umedit mkdir -p ~/.notes; nvim ~/.notes/$argv[1]; end function um mdless ~/.notes/"$argv[1]" end function umls ls ~/.notes/ end

(reminder, to make them permanent just: `funcsave mdless umedit um umls`)

Re:Um – Create your own man pages so you can remember how to... by citruscomputing on Tuesday August 21, 2018 @03:02AM (#17807634)
umedit with templating:

    function umedit() {
        mkdir -p ~/.notes
        if [ ! -f ~/.notes/$1.md ]; then
            echo "% $(echo $1 | tr '[:lower:]' '[:upper:]')(shell) Um Pages | Um Page" >> ~/.notes/$1.md
            echo "\n# NAME\n$1 - $(whatis $1 2> /dev/null | cut -d '-' -f 2 | awk '{$1=$1};1')\n\n# COMMANDS" >> ~/.notes/$1.md
        fi
        vim ~/.notes/$1.md
    }
Re:Um – Create your own man pages so you can remember how to... by v_lisivka on Monday August 20, 2018 @11:37AM (#17800808)
But how to share these man pages and how to search for man pages written by others?

I can share my man pages with git/github, but nobody will notice them, nobody will fix my spelling errors or contribute additional information.

Is there something like wiki, but for man pages?

Re:Um – Create your own man pages so you can remember how to... by masukomi on Monday August 20, 2018 @01:18PM (#17801788)
> Is there something like wiki, but for man pages?

yes. it's the source repo for whatever app you want improved man pages on. Everyone can submit changes to it. All the good ones get merged in. It's effectively a wiki curated by the most knowledgeable people on the subject.

um solves a different problem though. It's not trying to make a _common_ man page. It's trying to make a man page that works _for you_. What _you_ need to be highlighted is likely different from what _I_ need to be highlighted.

Personally I don't _want_ a generic wiki man page for stuff. I like the man pages written by the creators of the code (because i know they're correct), combined with my notes highlighting what's important to me.