diff options
Diffstat (limited to 'src/local/pager.nim')
-rw-r--r-- | src/local/pager.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index d4853d31..dce66505 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -854,9 +854,7 @@ type ExternDict = object of JSDict suspend: Opt[bool] wait: bool -#TODO this could be handled much better. -# * suspend, setenv, wait as dict flags -# * retval as int? +#TODO we should have versions with retval as int? proc extern(pager: Pager, cmd: string, t = ExternDict()): bool {.jsfunc.} = if t.setenv.get(true): pager.setEnvVars() @@ -865,6 +863,13 @@ proc extern(pager: Pager, cmd: string, t = ExternDict()): bool {.jsfunc.} = else: return runProcess(cmd) +proc externCapture(pager: Pager, cmd: string): Opt[string] {.jsfunc.} = + pager.setEnvVars() + var s: string + if not runProcessCapture(pager.term, cmd, s): + return err() + return ok(s) + proc authorize(pager: Pager) = pager.setLineEdit("Username: ", USERNAME) |