feat: Added auto
, always
, never
modifiers to --hyperlink
argument (V2)
#1059
+59
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is continuation of @mrnossiom's work in #746 (as I've learned already after I started coding current PR myself) with added shell completions and which doesn't have merge conflicts with the
main
branch.Description
Add a
WHEN
modifier to the--hyperlink
argument. This matches bothls
behavior and the--color
argument behavior.I think
ls
is doing it right because you might want to enable--hyperlink
in a shell alias but still get plain text when piping into some other program without control chars in the way. Setting--hyperlink
in a shell alias is useful for terminal integration (e.g. Kitty).The public API is compatible since
--hyperlink
defaults toauto
and doesn't break. However, it changes the behavior, with no value the option worked likealways
but it now defaults toauto
. Even though I considerauto
to be the right default, maybe it could be changed toalways
to keep old meaning.