File: password.go

package info (click to toggle)
golang-gopkg-readline.v1 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 292 kB
  • sloc: makefile: 4
file content (32 lines) | stat: -rw-r--r-- 592 bytes parent folder | download
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
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,

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