7 ms·
That project is a symptom of manual pages not having good “EXAMPLES” sections. The examples on that web page should be contributed upstream to the manuals pages
by teddyh 11y ago
That project is a symptom of manual pages not having good “EXAMPLES” sections. The examples on that web page should be contributed upstream to the manuals pages of the software that they are for.
If you want a fast way to read the EXAMPLES section only for a command, here is a shell function which creates an ‘eg’ command which only displays the “EXAMPLES” section of manual pages:
eg(){
MAN_KEEP_FORMATTING=1 man "$@" 2>/dev/null \
| sed --quiet --expression='/^E\(\x08.\)X\(\x08.\)\?A\(\x08.\)\?M\(\x08.\)\?P\(\x08.\)\?L\(\x08.\)\?E/{:a;p;n;/^[^ ]/q;ba}' \
| ${MANPAGER:-${PAGER:-pager -s}}
}
Usage:
$ eg tar
EXAMPLES
Create archive.tar from files foo and bar.
tar -cf archive.tar foo bar
List all files in archive.tar verbosely.
tar -tvf archive.tar
Extract all files from archive.tar.
tar -xf archive.tar
$
(Previously: https://news.ycombinator.com/item?id=10025216 https://news.ycombinator.com/item?id=10025216, https://news.ycombinator.com/item?id=7123328 https://news.ycombinator.com/item?id=7123328)
- vitd 11y agoI don't mean to sound cynical, but if oft-used man pages haven't already added "EXAMPLES" sections over the last 30 years, how likely is it that they'd add them now? This project exists because man has failed to as useful as it needs to be for current users. I don't think that adding this info to the "EXAMPLES" sections will help anything, personally.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- klodolph 11y ago> if oft-used man pages haven't already added "EXAMPLES" sections over the last 30 years, how likely is it that they'd add them now? Lots of reasons they didn't add examples earlier. Maybe nobody happened to care, but if you submit a patch, they'll gladly accept it? Why so cynical?
- teddyh 11y agoThat’s like saying “We haven’t needed ‘TLDR pages’ for the last 30 years, why do we need them now?”. Times change.
- alexwebb2 11y agoThe fact that something hasn't been done doesn't mean there isn't a need for it.