Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Request missing parameters for add-contact command
- Loading branch information
Showing
3 changed files
with
40 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(export #t) | ||
;; TODO the contents of this file should be upstreamed to gerbil-utils/cli | ||
;; Not upstreamed yet because there is a dependency on | ||
;; :glow/runtime/terminal-codes (which should be upstreamed eventually as well). | ||
(import :clan/base :gerbil/gambit/ports :mukn/glow/runtime/terminal-codes) | ||
|
||
(def (display-prompt name) | ||
(displayln CYAN name) | ||
(display (string-append "> " END)) | ||
(force-output)) | ||
|
||
(def (ask-string name) | ||
(display-prompt name) | ||
(def result (read-line)) | ||
(displayln) | ||
result) | ||
|
||
;; If option is undefined, request it | ||
(def (get-or-ask options option ask-function) | ||
(or (hash-get options option) | ||
(let (input (apply ask-function [])) | ||
(hash-put! options option input) | ||
input))) |