mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 02:23:24 +00:00
config, terminal: move PasswordPromptOutput from config to terminal
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.
This commit is contained in:
@@ -8,8 +8,6 @@ import (
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"github.com/rclone/rclone/fs/config"
|
||||
|
||||
colorable "github.com/mattn/go-colorable"
|
||||
)
|
||||
|
||||
@@ -70,12 +68,15 @@ const (
|
||||
var (
|
||||
// make sure that start is only called once
|
||||
once sync.Once
|
||||
|
||||
// PasswordPromptOutput is output of prompt for password
|
||||
PasswordPromptOutput = os.Stderr
|
||||
)
|
||||
|
||||
// Start the terminal - must be called before use
|
||||
func Start() {
|
||||
once.Do(func() {
|
||||
f := config.PasswordPromptOutput
|
||||
f := PasswordPromptOutput
|
||||
if !IsTerminal(int(f.Fd())) {
|
||||
// If output is not a tty then remove escape codes
|
||||
Out = colorable.NewNonColorable(f)
|
||||
|
||||
Reference in New Issue
Block a user