An Unset Proxy Variable Can Remove the Whole Argument in Fish
Quote a proxy diagnostic in Fish so an unset or zero-element variable does not erase the label attached to it.
In Fish, this diagnostic can print just a newline:
echo HTTPS_PROXY=$HTTPS_PROXY
Fish variables contain lists. When an unquoted variable is attached to text, Fish combines that text with each list element. An undefined variable, or a variable defined with no elements, produces no combinations. The entire argument disappears, including HTTPS_PROXY=.
Keep the label by quoting the expansion:
printf '%s\n' "HTTPS_PROXY=$HTTPS_PROXY"
This supplies one argument even when the variable has no elements, so the label remains visible. Quoting a multi-element variable joins its elements with spaces; it does not prove that the variable contains one usable proxy URL.
To check whether the variable exists, use Fish's query operation:
if set --query HTTPS_PROXY
printf '%s\n' "HTTPS_PROXY=$HTTPS_PROXY"
else
echo 'HTTPS_PROXY is not defined'
end
A successful query means the variable is defined, not necessarily that it contains a nonempty value or that a client will use it. Exporting and client-specific proxy discovery are separate checks.