dylanaraps / neofetch

🖼️ A command-line system information tool written in bash 3.2+
MIT License
21.88k stars 1.76k forks source link

feat: display editor setting #2271

Open m-ildefons opened 1 year ago

m-ildefons commented 1 year ago

Screenshot at 2022-12-28 17-31-19

Display the configured editor, version and path using the $EDITOR environment variable similar to the way the shell version is displayed from the $SHELL variable.

fixes: #2270

TODO

hykilpikonna commented 1 year ago

Currently, if neither $VISUAL nor $EDITOR is set, the code will return "command not found" when trying to run $editor_full_path when it's empty. Can you add a null check or ignore stderr?

image

image

hykilpikonna commented 1 year ago

You can add

[[ -z "$editor_full_path" ]] && return
m-ildefons commented 1 year ago

Hi, thanks for pointing this out. I corrected it and also added the options to the man page. It will still fail to execute if $VISUAL (or $EDITOR) is set to something that isn't executable, but that would be quite a rare misconfiguration, so I'm not sure it's worth handling this case?

hykilpikonna commented 1 year ago

Works!

image

hykilpikonna commented 1 year ago

It will still fail to execute if $VISUAL (or $EDITOR) is set to something that isn't executable, but that would be quite a rare misconfiguration, so I'm not sure it's worth handling this case?

Yea that's fine, we can assume that EDITOR is correctly configured

hykilpikonna commented 1 year ago

Thank you for your contribution!

This PR is merged into hyfetch since this repo (dylanaraps/neofetch) seems no longer maintained.

HyFetch is a fork of neofetch with LGBTQ pride flags, but the repo also maintains an updated version of the original neofetch, addressing many pull requests that are not merged in the original repo.

Read the "Running Updated Original Neofetch" section for more info!

hykilpikonna commented 1 year ago

Found another bug - when the editor doesn't support --version option (the pico editor for example), neofetch will be stuck on this line:

image

And by default, macOS links nano to pico:

image

Therefore, I removed the version check for editor so that editors that doesn't support --version will now be unstuck.