example: update

This commit is contained in:
Cheney 2015-11-20 21:00:05 +08:00
parent 71e9536f4b
commit 839c0013a8
2 changed files with 5 additions and 5 deletions

View File

@ -47,15 +47,13 @@ var completer = readline.NewPrefixCompleter(
)
func main() {
cfg := &readline.Config{
l, err := readline.NewEx(&readline.Config{
Prompt: "\033[31m»\033[0m ",
HistoryFile: "/tmp/readline.tmp",
AutoComplete: completer,
InterruptPrompt: "\nInterrupt, Press Ctrl+D to exit",
EOFPrompt: "exit",
}
l, err := readline.NewEx(cfg)
})
if err != nil {
panic(err)
}

View File

@ -315,7 +315,9 @@ func (o *Operation) GenPasswordConfig() *Config {
}
func (o *Operation) PasswordWithConfig(cfg *Config) ([]byte, error) {
o.opPassword.EnterPasswordMode(cfg)
if err := o.opPassword.EnterPasswordMode(cfg); err != nil {
return nil, err
}
defer o.opPassword.ExitPasswordMode()
return o.Slice()
}