File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,18 @@ exports.prompt = function (readline) {
31
31
} ;
32
32
} ;
33
33
34
+ exports . question = function ( text ) {
35
+ return function ( callback ) {
36
+ return function ( readline ) {
37
+ return function ( ) {
38
+ readline . question ( text , function ( result ) {
39
+ callback ( result ) ( ) ;
40
+ } ) ;
41
+ } ;
42
+ } ;
43
+ } ;
44
+ } ;
45
+
34
46
exports . setPrompt = function ( prompt ) {
35
47
return function ( length ) {
36
48
return function ( readline ) {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module Node.ReadLine
17
17
, setPrompt
18
18
, setLineHandler
19
19
, close
20
+ , question
20
21
) where
21
22
22
23
import Prelude
@@ -100,6 +101,16 @@ foreign import prompt
100
101
. Interface
101
102
-> Eff (readline :: READLINE | eff ) Unit
102
103
104
+ -- | Writes a query to the output, waits
105
+ -- | for user input to be provided on input, then invokes
106
+ -- | the callback function
107
+ foreign import question
108
+ :: forall eff
109
+ . String
110
+ -> (String -> Eff (readline :: READLINE | eff ) Unit )
111
+ -> Interface
112
+ -> Eff (readline :: READLINE | eff ) Unit
113
+
103
114
-- | Set the prompt.
104
115
foreign import setPrompt
105
116
:: forall eff
You can’t perform that action at this time.
0 commit comments