First, move this variable in order to avoid circular imports between
config and terminal. (config already depends on terminal.)
But also, it seems PasswordPromptOutput conceptually fits well in
terminal, as the idea is for it to store the output for the terminal.
--progress and --log-file should be usable together, but windows
does not currently preserve the original stderr in
config.PasswordPromptOutput; so use stdout explicitly to match the
old behavior.
Avoid mixing rclone command output with progress output by sending
terminal output to stderr.
Discussion:
The --progress option produces output designed for the terminal, and the
terminal library sent all its output to stdout.
This is a problem for any command that produces output for further
processing, when combined with --progress, because the main command
output and the progress output are then sent together to stdout.
This is most obviously a problem for the rclone 'cat' command. Say you
want to retrieve a large file but output to a pipe for further
processing, rather than write it to a file. But you also want rclone to
display its progress output as you wait for the transfer. Because both
the 'cat' output and the progress output go to stdout, this leaves the
progress output as garbage data within the streamed cat output, and also
prevents the progress output from being displayed.
Notably, other rclone commands like 'ls', 'lsjson', and even 'm5dsum',
produce meaningful progress output with the --progress option, but when
mixed with the regular command output, it makes both the progress output
and the command output unusable.
The simple solution here is to send output intended for the terminal
(including progress output) to stderr instead of stdout. This way the
rclone command output can be redirected as desired from stdout, and the
progress output will still go to the terminal attached to stderr.
If for some reason the user wants to capture/redirect the
terminal/progress output for some other purpose, stderr can be
redirected instead.
golang.org/x/crypto/ssh/terminal is deprecated in favor of
golang.org/x/term, see https://pkg.go.dev/golang.org/x/crypto/ssh/terminal
The latter also supports ReadPassword on solaris, so enable the
respective functionality in fs/config for solaris as well.
Adds a flag, --progress-terminal-title, that when used with --progress,
will print the string `ETA: %s` to the terminal title.
This also adds WriteTerminalTitle to lib/terminal