mirror of https://github.com/chzyer/readline.git
example: update
This commit is contained in:
parent
71e9536f4b
commit
839c0013a8
|
@ -47,15 +47,13 @@ var completer = readline.NewPrefixCompleter(
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg := &readline.Config{
|
l, err := readline.NewEx(&readline.Config{
|
||||||
Prompt: "\033[31m»\033[0m ",
|
Prompt: "\033[31m»\033[0m ",
|
||||||
HistoryFile: "/tmp/readline.tmp",
|
HistoryFile: "/tmp/readline.tmp",
|
||||||
AutoComplete: completer,
|
AutoComplete: completer,
|
||||||
InterruptPrompt: "\nInterrupt, Press Ctrl+D to exit",
|
InterruptPrompt: "\nInterrupt, Press Ctrl+D to exit",
|
||||||
EOFPrompt: "exit",
|
EOFPrompt: "exit",
|
||||||
}
|
})
|
||||||
|
|
||||||
l, err := readline.NewEx(cfg)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,9 @@ func (o *Operation) GenPasswordConfig() *Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Operation) PasswordWithConfig(cfg *Config) ([]byte, error) {
|
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()
|
defer o.opPassword.ExitPasswordMode()
|
||||||
return o.Slice()
|
return o.Slice()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue