File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -45,4 +45,11 @@ exports.createInterface = function(completer) {
45
45
}
46
46
} ) ;
47
47
} ;
48
- } ;
48
+ } ;
49
+
50
+ exports . close = function ( readline ) {
51
+ return function ( ) {
52
+ readline . close ( ) ;
53
+ return readline ;
54
+ } ;
55
+ } ;
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ foreign import setPrompt :: forall eff. String -> Int -> Interface -> Eff (conso
33
33
-- | Create an interface with the specified completion function.
34
34
foreign import createInterface :: forall eff . Completer eff -> Eff (console :: CONSOLE | eff ) Interface
35
35
36
+ -- | Close the specified `Interface`.
37
+ foreign import close :: forall eff . Interface -> Eff (console :: CONSOLE | eff ) Interface
38
+
36
39
-- | A completion function which offers no completions.
37
40
noCompletion :: forall eff . Completer eff
38
41
noCompletion s = return { completions: [] , matched: s }
Original file line number Diff line number Diff line change @@ -12,8 +12,12 @@ main = do
12
12
13
13
let
14
14
lineHandler s = do
15
- log $ " You typed: " ++ s
16
- prompt interface
15
+ if s == " quit"
16
+ then do
17
+ close interface
18
+ else do
19
+ log $ " You typed: " ++ s
20
+ prompt interface
17
21
18
22
setPrompt " > " 2 interface
19
23
prompt interface
You can’t perform that action at this time.
0 commit comments