readline/password.go

34 lines
630 B
Go
Raw Normal View History

2015-11-20 15:56:42 +03:00
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{
2016-03-05 05:46:11 +03:00
EnableMask: true,
2015-11-20 15:56:42 +03:00
InterruptPrompt: "\n",
EOFPrompt: "\n",
HistoryLimit: -1,
2017-11-03 16:19:23 +03:00
Painter: &defaultPainter{},
2015-11-20 15:56:42 +03:00
Stdout: o.o.cfg.Stdout,
Stderr: o.o.cfg.Stderr,
}
}