Compare commits

...

2 Commits

Author SHA1 Message Date
sammyette 4596159b8f
feat: add command.precmd hook 2021-10-13 22:53:09 -04:00
sammyette 9eabe5323d
fix: throw command.exit with 0 code if input is nothing 2021-10-13 22:51:38 -04:00
2 changed files with 5 additions and 1 deletions

View File

@ -184,7 +184,10 @@ input:
} }
input = strings.TrimSpace(input) input = strings.TrimSpace(input)
if len(input) == 0 { continue } if len(input) == 0 {
hooks.Em.Emit("command.exit", 0)
continue
}
if strings.HasSuffix(input, "\\") { if strings.HasSuffix(input, "\\") {
for { for {

1
rl.go
View File

@ -22,6 +22,7 @@ func NewLineReader(prompt string) *LineReader {
} }
func (lr *LineReader) Read() (string, error) { func (lr *LineReader) Read() (string, error) {
hooks.Em.Emit("command.precmd", nil)
return readline.String(lr.Prompt) return readline.String(lr.Prompt)
} }