dylanaraps/neofetch

[Feature Suggestion] Add Flag for Info to Fail Loudly

AzureArmageddon opened this issue · 0 comments

Description

Right now, it seems that when info "abc" abc doesn't get any information back, that particular info line is simply omitted from Neofetch's output.

The idea is I and I think others might appreciate a flag/option that, when a particular line of info cannot be obtained, does not omit the line (failing quietly), but instead does something to the effect of prin "abc" " " or prin "abc" "Something went wrong." maybe with a customisable message (failing loudly).

Examples

  • info "Local IP" local_ip works fine when connected to a network but when disconnected from the network, the info line is currently simply omitted and absent from the output (without helpful error message or acknowledgement)
  • In a regular Terminal.app window, info "Terminal Font" term_font works fine but the info line is currently omitted if I run Neofetch from within tmux and neofetch fails to obtain the information (without helpful error message or acknowledgement)

Workaround

One can include a workaround like below in their config file, though I speculate it may be better to implement in source, though I've never made a PR before (let alone worked in this codebase) and don't know how I might go about making a PR to add this feature.

local_ip_info="$(info "Local IP" local_ip)" # Catch info without echoing it

if [[ $local_ip_info ]] then # If info returned a non-empty string
    echo "$local_ip_info" # Echo the info line normally
else # If info returned empty string
    prin "Local IP" " " # Don't omit line, send incomplete line instead