mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpgscm: Library improvements.
* tests/gpgscm/repl.scm (prompt-yes-no?): New function. * tests/gpgscm/tests.scm (pathsep-split): Likewise. (pathsep-join): Likewise. (with-path): Use the new function. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
7a6e6ad288
commit
b4d25082fd
2 changed files with 23 additions and 1 deletions
|
@ -55,3 +55,15 @@
|
|||
(define (interactive-repl . environment)
|
||||
(repl (lambda (p) (prompt-append-prefix "gpgscm " p))
|
||||
(if (null? environment) (interaction-environment) (car environment))))
|
||||
|
||||
;; Ask a yes/no question.
|
||||
(define (prompt-yes-no? question default)
|
||||
(let ((answer (prompt (string-append question "? ["
|
||||
(if default "Y/n" "y/N") "] "))))
|
||||
(cond
|
||||
((= 0 (string-length answer))
|
||||
default)
|
||||
((or (equal? "y" answer) (equal? "Y" answer))
|
||||
#t)
|
||||
(else
|
||||
#f))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue