nim secret: support linenoise when available (#13328)
This commit is contained in:
parent
c6d5f0df8d
commit
574f61315d
1 changed files with 4 additions and 4 deletions
|
|
@ -12,9 +12,9 @@
|
||||||
import
|
import
|
||||||
pathutils
|
pathutils
|
||||||
|
|
||||||
# support '-d:useGnuReadline' for backwards compatibility:
|
template imp(x) = import x
|
||||||
when not defined(windows) and (defined(useGnuReadline) or defined(useLinenoise)):
|
const hasRstdin = compiles(imp(rdstdin))
|
||||||
import rdstdin
|
when hasRstdin: import rdstdin
|
||||||
|
|
||||||
type
|
type
|
||||||
TLLRepl* = proc (s: PLLStream, buf: pointer, bufLen: int): int
|
TLLRepl* = proc (s: PLLStream, buf: pointer, bufLen: int): int
|
||||||
|
|
@ -67,7 +67,7 @@ proc llStreamClose*(s: PLLStream) =
|
||||||
of llsFile:
|
of llsFile:
|
||||||
close(s.f)
|
close(s.f)
|
||||||
|
|
||||||
when not declared(readLineFromStdin):
|
when not hasRstdin:
|
||||||
# fallback implementation:
|
# fallback implementation:
|
||||||
proc readLineFromStdin(prompt: string, line: var string): bool =
|
proc readLineFromStdin(prompt: string, line: var string): bool =
|
||||||
stderr.write(prompt)
|
stderr.write(prompt)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue