On 29/12/2025 23:26, Pádraig Brady wrote:
On 20/12/2025 21:16, Egmont Koblinger wrote:
>> Pádraig Brady wrote:
We only output --option links if stdout is a tty currently,
though it would be nice to support piping to e.g., less -R.
Perhaps keying on stdin would be better then, or maybe support --help[=WHEN],
though options on --help do seem like overkill.

I understand your dilemma and it's surely not an easy question.

Another possibility is to piggyback on the existing --hyperlink
feature. This way existing aliases (e.g. alias ls='ls --hyperlink')
would work. But this also takes us to the question of the _default_
value.

Currently ls defaults to no hyperlinks when listing regular files, but
(with this patch) to do use hyperlinks in --help. Would you prefer to
keep it this way? I think if the main operation doesn't use hyperlinks
or colors by default (it's left for aliases to enable them) then it's
reasonable for --help to follow that, too. Also, using bold typeface
isn't subject to --color in --help, that's another inconsistency
between --help vs. real operation.

It would be preferable to find a solution that scales well to other
tools, including non-coreutils ones, e.g. grep with its already
existing --color similarly to ls.

I don't have a firm opinion what would be a great solution here, but I
think reusing --hyperlink (or introducing it to other tools) might be
a viable option.

But then again, _if_ you choose to go bold too, then would you need
two options (--hyperlink=... and --color=...) to turn on/off them
both? Doesn't sound that great. Surely a single option controlling
them would be better.

I've gone with always outputting the ansi codes,
as really all that post processes --help is help2man
and I've adjusted that to handle all output formats.
Any further grepping/paging should work fine with the codes.

Hrm I'm just thinking that _comp_compgen_help in bash_completion may have 
issues.
I'll think about this a little more.

cheers,
Padraig

Reply via email to