From: Alejandro Colomar <alx@kernel.org>
To: onf <onf@disroot.org>
Cc: linux-man@vger.kernel.org, groff@gnu.org
Subject: Re: diffman(1)
Date: Mon, 25 Nov 2024 17:34:21 +0100 [thread overview]
Message-ID: <20241125163421.f37ftfuxq33bax2v@devuan> (raw)
In-Reply-To: <D5VE1OMV9LG2.3GYDJOAGFIR0F@disroot.org>
[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]
Hi onf,
On Mon, Nov 25, 2024 at 05:08:48PM +0100, onf wrote:
> Hi Alejandro,
>
> On Mon Nov 25, 2024 at 1:44 PM CET, Alejandro Colomar wrote:
> > You may find it useful for development of manual pages. If so, please
> > let me know any feedback you have for it. I was wondering if I should
> > pipe to less -R, just like man(1) does. For now, having doubts, I kept
> > it simple, which would allow wrapping this in fancier scripts that for
> > exaple diff an entire repository of manual pages (although that maybe
> > calls for running groff(1) and diff(1) directly).
>
> less simply pipes the data through if it's not at the end of a pipeline,
> so piping the diff's output to less -R shouldn't complicate use in
> scripts in any way (except perhaps for escape sequences if you use
> color).
I've seen less(1) cause issues when called in a while loop.
And indeed, there's good reasons for calling this in a loop.
Here's a useful wrapper I came up with after writing this email:
$ tail -n19 scripts/bash_aliases
# diff all modified pages against the system ones.
duffman()
{
cd $(git rev-parse --show-toplevel);
git diff --name-only \
| grep -E \
'(\.[[:digit:]]([[:alpha:]][[:alnum:]]*)?\>|\.man)+(\.man|\.in)*$' \
| sortman \
| while read f; do \
local sys="$(basename "$f")";
diffman "$sys" "$f";
done \
| less -R;
cd -;
}
>
> $ less -R /usr/include/stdio.h | grep -E '^#' | wc -l
> 241
> $ sed -E "s/^/$(printf '\033[1m')/; s/\$/$(printf '\033[m')/" \
> /usr/include/stdio.h | less -R | wc -l
> 985
>
> ~ onf
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-11-25 16:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 12:44 diffman(1) Alejandro Colomar
2024-11-25 13:35 ` diffman(1) Alejandro Colomar
2024-11-25 16:08 ` diffman(1) onf
2024-11-25 16:34 ` Alejandro Colomar [this message]
2025-01-09 13:59 ` duffman(1) (was: diffman(1)) Alejandro Colomar
2025-01-10 4:30 ` onf
2025-01-10 9:17 ` Alejandro Colomar
2025-01-10 9:45 ` onf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241125163421.f37ftfuxq33bax2v@devuan \
--to=alx@kernel.org \
--cc=groff@gnu.org \
--cc=linux-man@vger.kernel.org \
--cc=onf@disroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox