mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-23 19:36:53 +00:00
nim secret: support linenoise when available (#13328)
This commit is contained in:
@@ -12,9 +12,9 @@
|
||||
import
|
||||
pathutils
|
||||
|
||||
# support '-d:useGnuReadline' for backwards compatibility:
|
||||
when not defined(windows) and (defined(useGnuReadline) or defined(useLinenoise)):
|
||||
import rdstdin
|
||||
template imp(x) = import x
|
||||
const hasRstdin = compiles(imp(rdstdin))
|
||||
when hasRstdin: import rdstdin
|
||||
|
||||
type
|
||||
TLLRepl* = proc (s: PLLStream, buf: pointer, bufLen: int): int
|
||||
@@ -67,7 +67,7 @@ proc llStreamClose*(s: PLLStream) =
|
||||
of llsFile:
|
||||
close(s.f)
|
||||
|
||||
when not declared(readLineFromStdin):
|
||||
when not hasRstdin:
|
||||
# fallback implementation:
|
||||
proc readLineFromStdin(prompt: string, line: var string): bool =
|
||||
stderr.write(prompt)
|
||||
|
||||
Reference in New Issue
Block a user