xh icon indicating copy to clipboard operation
xh copied to clipboard

Support silencing warnings via double `-q` flag

Open ducaale opened this issue 4 years ago • 3 comments

See https://github.com/httpie/httpie/issues/1100 and https://github.com/httpie/httpie/pull/1175

ducaale avatar Oct 13 '21 14:10 ducaale

I'm considering implementing this feature but it seems that xh already silences warnings.

   ~ ─────────────────────────────────────────────────────────────────────────────── 19:22:57 
❯ http --check-status --quiet pie.dev/status/500

http: warning: HTTP 500 Internal Server Error

   ~ ─────────────────────────────────────────────────────────────────────────────── 19:23:09 
❯ xh --check-status --quiet pie.dev/status/500
   ~ ─────────────────────────────────────────────────────────────────────────────── 19:23:18 
❯

Should this be changed along with the addition of -qq?

Abdiramen avatar Oct 17 '21 02:10 Abdiramen

Should this be changed along with the addition of -qq?

Yes, please. Unlike HTTPie, we aren't currently outputting HTTP warnings if the --quite or --output flag is being used.

xh

$ xh --check-status --quiet pie.dev/status/500
$ xh --check-status --output /dev/null pie.dev/status/500
$ xh --check-status pie.dev/status/500 > /dev/null
xh: warning: HTTP 500 Internal Server Error

HTTPie

$ http --check-status --quiet pie.dev/status/500

http: warning: HTTP 500 Internal Server Error

$ http --check-status --output /dev/null pie.dev/status/500

http: warning: HTTP 500 Internal Server Error

$ http --check-status pie.dev/status/500 > /dev/null

http: warning: HTTP 500 Internal Server Error

This can be fixed by:

  1. Modifying this line to take args.quite into account.
  2. Checking if we're not outputting into the terminal instead of checking if we have a redirected output.

ducaale avatar Oct 17 '21 11:10 ducaale

Is this issue still open?

farmeroy avatar Sep 05 '23 02:09 farmeroy