Open lberrymage opened 3 years ago
Some
) or disable (None
) your helper. But I suppose no one uses set_helper(None)
. Maybe we should have a constructor instead Editor::with_helper(...)
?Error
but currently cannot.Your "invalid command"
message should be displayed with rustyline version >= 7.0.0
I'm trying to use
Validator
to automatically validate custom, single-line commands. As a test for handling invalid input I set up the following code:What's curious is that "invalid command" is never printed to the terminal no matter whether the input is empty, contains one "word," or contains multiple "words." Notably, adding
rl.set_helper(Some(CommandHelper { }))
before the REPL preventsreadline()
from ever returning without interrupting the process with CTRL-C. Theinput_validation
example suffers from these same problems if the user enters anything butSELECT <anything_goes_here> ;
on the first line.My questions are:
Editor::set_helper()
, and does it need to exist? If yes to either of these, is this documented?Validator
that explains its usage?input_validation
example truly broken, or am I missing something?Additionally:
Validator::validate()
return aResult<ValidationError, ReadlineError>
, considering its only input is effectively a string slice? When would it return returnReadlineError
?Editor::set_helper()
does has a use, why does it takeOption<impl Helper>
instead of justimpl Helper
? What is the use case of passing itNone
?I am very willing to improve documentation on these subjects (once I understand them myself), write/fix examples, etc..