cli icon indicating copy to clipboard operation
cli copied to clipboard

Allow disabling progress bar for logging in Download mode

Open arjunv opened this issue 4 years ago • 6 comments

In Download mode, httpie adds a progress bar which is printed along with the response headers. Both are logged to stderr preventing the progress bar from being skipped while logging response to a logfile using say output redirection.

I'd suggest either an argument to disable progress bar, --no-progress-bar or print the progress bar to stdout so that only stderr can be logged to files and stdout can be send to ~~hell~~ /dev/null

For now I forced to do this instead :( image

arjunv avatar Mar 28 '20 17:03 arjunv

Hi @arjunv, what is your exact use case (the whole command invocation would help)?

while logging response to a logfile using say output redirection

What do you mean by "response" here?

jkbrzt avatar Apr 13 '20 15:04 jkbrzt

My use case is that it messes up this:

http -d http://example.com | tar xvz -

Because httpie and tar are spouting info to the terminal. I'd like to be able to turn off the progress stuff while in a piped situation.

artfulrobot avatar Apr 22 '20 17:04 artfulrobot

I've begun work on a terminal flag to disable the download progress bar. Currently, it disables the section that @arjunv commented out in his screenshot. Is there anything else it should disable?

PerfectlyInternal avatar Jan 09 '21 18:01 PerfectlyInternal

Is there anything else it should disable?

Sorry for the delay, but wouldn't it be better to send the progress bar output to stdout?

arjunv avatar Jan 12 '21 09:01 arjunv

But is stdout not where the downloaded information is being sent? Mixing the progress bar into that doesn't seem like it would work well, especially not if you're going to be piping that into something else.

PerfectlyInternal avatar Jan 12 '21 14:01 PerfectlyInternal

Got it.

The confusion was that httpie's download mode works very differently based on with/without pipe and with/without --output

For eg if I wanted to download a file and store the response headers to a separate log file, I'd have logically assumed that the following would work. http -d https://google.com/favicon.ico -o favicon.ico | tee response.txt

It looks like there is no option to do something like that in httpie currently? Because when I tried to log stderr as well, only the progress bar contents are saved and not the response headers. http -d https://google.com/favicon.ico -o favicon.ico 2>&1 | tee response.txt

arjunv avatar Jan 14 '21 18:01 arjunv