summaryrefslogtreecommitdiff
path: root/vendor/github.com/chzyer/readline/password.go
blob: 414288c2a5022fb30ef4b56ffc571dfd31c125c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package readline

type opPassword struct {
	o         *Operation
	backupCfg *Config
}

func newOpPassword(o *Operation) *opPassword {
	return &opPassword{o: o}
}

func (o *opPassword) ExitPasswordMode() {
	o.o.SetConfig(o.backupCfg)
	o.backupCfg = nil
}

func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) {
	o.backupCfg, err = o.o.SetConfig(cfg)
	return
}

func (o *opPassword) PasswordConfig() *Config {
	return &Config{
		EnableMask:      true,
		InterruptPrompt: "\n",
		EOFPrompt:       "\n",
		HistoryLimit:    -1,
		Painter:         &defaultPainter{},

		Stdout: o.o.cfg.Stdout,
		Stderr: o.o.cfg.Stderr,
	}
}