Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities when writing interactive programs that interpret commands, e.g. a REPL.
- simpleCompletion :: String -> CommandDesc () -> String -> String
- shellCompletionWords :: String -> CommandDesc () -> String -> [CompletionItem]
- interactiveHelpDoc :: String -> CommandDesc () -> String -> Int -> Doc
- partDescStrings :: PartDesc -> [String]
Documentation
:: String | input string |
-> CommandDesc () | CommandDesc obtained on that input string |
-> String | "remaining" input after the last successfully parsed
subcommand. See |
-> String | completion, i.e. a string that might be appended to the current prompt when user presses tab. |
Derives a potential completion from a given input string and a given
CommandDesc
. Considers potential subcommands and where available the
completion info present in PartDesc
s.
:: String | input string |
-> CommandDesc () | CommandDesc obtained on that input string |
-> String | "remaining" input after the last successfully parsed
subcommand. See |
-> [CompletionItem] |
Derives a list of completion items from a given input string and a given
CommandDesc
. Considers potential subcommands and where available the
completion info present in PartDesc
s.
See addShellCompletion
which uses this.
:: String | input string |
-> CommandDesc () | CommandDesc obtained on that input string |
-> String | "remaining" input after the last successfully parsed
subcommand. See |
-> Int | max length of help text |
-> Doc |
Produces a Doc
as a hint for the user during interactive command
input. Takes the current (incomplete) prompt line into account. For example
when you have commands (among others) 'config set-email' and
'config get-email', then on empty prompt there will be an item 'config';
on the partial prompt 'config ' the help doc will contain the
'set-email' and 'get-email' items.
partDescStrings :: PartDesc -> [String] Source #
Obtains a list of "expected"/potential strings for a command part
described in the PartDesc
. In constrast to the simpleCompletion
function this function does not take into account any current input, and
consequently the output elements can in general not be appended to partial
input to form valid input.