Skip to content

Nushell ls gives clickable links in its result, resulting in a technical correct, but perhaps a bit unexpected result. #2762

Answered by BurntSushi
trondhe asked this question in General
Discussion options

You must be logged in to vote

Yes, okay, @ltrzesniewski's comment helped me figure this out. It's not just ls --hyperlink, but also ripgrep's color configuration. In particular, you report that this happens with ripgrep and not grep. That is likely because you don't have colors enabled for grep. Moreover, ls --hyperlink probably shouldn't be used at all. It should be ls --hyperlink=auto. The former forces hyperlinks to be written, where as the latter will suppress them when piping ls to some other tool. That's the right default. See:

$ ls | rg foo
foo
$ ls --hyperlink | rg foo
foofoo
$ ls --hyperlink=auto | rg foo
foo
$ ls --hyperlink | rg foo --color=never
foo
$ ls --hyperlink | grep foo
foofoo
$ ls --hyperlink=auto …

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@BurntSushi
Comment options

@ltrzesniewski
Comment options

@trondhe
Comment options

@BurntSushi
Comment options

Answer selected by BurntSushi
@fdncred
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants