Open 2crayon opened 1 month ago
Interesting!
Correct! Eza hardcodes this here: https://github.com/eza-community/eza/blob/bbede6d45398d0d6f5e7eb5cfff4ae4674e6315a/src/output/file_name.rs#L402
I looked at the ripgrep sources and they offer predefined aliases (https://github.com/BurntSushi/ripgrep/blob/f1d23c06e30606b2428a4e32da8f0b5069e81280/crates/printer/src/hyperlink_aliases.rs#L4-L22) and a parser for custom formats (https://github.com/BurntSushi/ripgrep/blob/f1d23c06e30606b2428a4e32da8f0b5069e81280/crates/printer/src/hyperlink.rs#L95-L171).
I think switching between predefined formats via a command line flag should be fairly straight forward to implement. Allowing the user to define a custom format is more involved though and also maybe a bit of overkill since we don't have that many interesting information to pack into a link as ripgrep with lines and colums within files. So we might wanna limit the scope when implementing this.
I think it would also be useful to be able to have different formats for different file types, so e.g. you could say that directories should open in a file explorer and regular files should open in a text editor.
Currently the hyperlink format in eza is hardcoded to be
file:///{path}
, ripgrep has the ability to change this format to whatever you want with some nice aliases https://github.com/BurntSushi/ripgrep/discussions/2611I would use this to list files in a project with
eza --tree
and have links always open in my text editor :)