]> gitweb.factorcode.org Git - factor.git/blob - extra/readline/readline-docs.factor
Update actions, because Node.js 16 actions are deprecated, to Node.js 20
[factor.git] / extra / readline / readline-docs.factor
1 ! Copyright (C) 2011 Erik Charlebois.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax strings ;
4 IN: readline
5
6 HELP: readline
7 { $values
8     { "prompt" string }
9     { "str" string }
10 }
11 { $description "Read a line from using readline." } ;
12
13 HELP: set-completion
14 { $values
15     { "quot" { $quotation ( str n -- str ) } }
16 }
17 { $description "Set the given quotation as the completion hook for readline. The quotation is called with the string to complete and the index in the completion list to return. When all completions have been returned, returning " { $snippet "f" } " terminates the loop." }
18 { $examples
19     { $unchecked-example "USING: readline sequences combinators kernel ;"
20                "[ nip [ \"keep\" \"dip\" ] ?nth ] set-completion"
21                ""
22     }
23 } ;
24
25 ARTICLE: "readline" "Readline"
26 "The " { $vocab-link "readline" } " vocabulary binds to the C readline library and provides Emacs-style key bindings for editing text. Currently, it only works from the non-graphical UI." $nl
27
28 "To read a line:"
29 { $subsections readline }
30 "To set a completion hook:"
31 { $subsections set-completion } ;
32
33 ABOUT: "readline"