You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
630 B

  1. package readline
  2. type opPassword struct {
  3. o *Operation
  4. backupCfg *Config
  5. }
  6. func newOpPassword(o *Operation) *opPassword {
  7. return &opPassword{o: o}
  8. }
  9. func (o *opPassword) ExitPasswordMode() {
  10. o.o.SetConfig(o.backupCfg)
  11. o.backupCfg = nil
  12. }
  13. func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) {
  14. o.backupCfg, err = o.o.SetConfig(cfg)
  15. return
  16. }
  17. func (o *opPassword) PasswordConfig() *Config {
  18. return &Config{
  19. EnableMask: true,
  20. InterruptPrompt: "\n",
  21. EOFPrompt: "\n",
  22. HistoryLimit: -1,
  23. Painter: &defaultPainter{},
  24. Stdout: o.o.cfg.Stdout,
  25. Stderr: o.o.cfg.Stderr,
  26. }
  27. }