add linenoise.readLineStatus to get status (eg: ctrl-D or ctrl-C) #16977
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
exitHandler
if status was ctrl-C for examplenim secret
being un-quittable, as described in control+D should exit nim secret; quit sometimes doesn't work timotheecour/Nim#533: in a next PR, we can use the new APIreadLineStatus
and exit the nim secret REPL if status was ctrl-Dnote
however this PR doesn't add more static variables, insted the state is propagated as a side variable allocated on the stack.
This is a small diff on the c side and the re-implementing in nim could be handled later; furthermore it's not clear re-implementing in nim is the correct approach, instead we should leverage nimble packages (eg https://github.com/jangko/nim-noise or https://github.com/de-odex/linenoise-nim) as described in update linenoise #16451 (comment)
I'm using the
nimExperimentalFoo
pattern described innimExperimentalFoo
for experimental modules/APIs timotheecour/Nim#575links
lino_error
exposed which has a similar goal, but this is a different portfuture work
nim secret
+ friends recognize ctrl-D =>^D
now works withreadLineFromStdin
(in particular innim secret
) #18442