sennenki/pretty_prompt/core does not have a README file
pub struct CompletionCommitContext {
snapshot : PromptSnapshot
key_press : KeyPress
selected_item : CompletionItem
span_to_replace : CompletionSpan
}fn CompletionCommitContext::new(snapshot : PromptSnapshot, key_press : KeyPress, selected_item : CompletionItem, span_to_replace : CompletionSpan) -> CompletionCommitContextfn CompletionRequest::new(snapshot : PromptSnapshot, span_to_replace : CompletionSpan) -> CompletionRequestpub struct CompletionSpan {
start : Int
length : Int
}fn CompletionTriggerContext::new(snapshot : PromptSnapshot, key_press : KeyPress) -> CompletionTriggerContextpub struct KeyBindings {
submit_prompt : KeyPressPatterns
new_line : KeyPressPatterns
cancel_prompt : KeyPressPatterns
history_previous : KeyPressPatterns
history_next : KeyPressPatterns
backward_delete_character : KeyPressPatterns
delete_character : KeyPressPatterns
move_left : KeyPressPatterns
move_right : KeyPressPatterns
move_home : KeyPressPatterns
move_end : KeyPressPatterns
move_word_left : KeyPressPatterns
move_word_right : KeyPressPatterns
backward_delete_word : KeyPressPatterns
delete_word : KeyPressPatterns
trigger_completion : KeyPressPatterns
dismiss_completion : KeyPressPatterns
undo : KeyPressPatterns
redo : KeyPressPatterns
move_left_selection : KeyPressPatterns
move_right_selection : KeyPressPatterns
move_home_selection : KeyPressPatterns
move_end_selection : KeyPressPatterns
copy_selection : KeyPressPatterns
cut_selection : KeyPressPatterns
kill_line_tail : KeyPressPatterns
kill_line_head : KeyPressPatterns
yank : KeyPressPatterns
yank_pop : KeyPressPatterns
reverse_search : KeyPressPatterns
paste : KeyPressPatterns
}fn KeyBindings::new(submit_prompt? : KeyPressPatterns, new_line? : KeyPressPatterns, cancel_prompt? : KeyPressPatterns, history_previous? : KeyPressPatterns, history_next? : KeyPressPatterns, backward_delete_character? : KeyPressPatterns, delete_character? : KeyPressPatterns, move_left? : KeyPressPatterns, move_right? : KeyPressPatterns, move_home? : KeyPressPatterns, move_end? : KeyPressPatterns, move_word_left? : KeyPressPatterns, move_word_right? : KeyPressPatterns, backward_delete_word? : KeyPressPatterns, delete_word? : KeyPressPatterns, trigger_completion? : KeyPressPatterns, dismiss_completion? : KeyPressPatterns, undo? : KeyPressPatterns, redo? : KeyPressPatterns, move_left_selection? : KeyPressPatterns, move_right_selection? : KeyPressPatterns, move_home_selection? : KeyPressPatterns, move_end_selection? : KeyPressPatterns, copy_selection? : KeyPressPatterns, cut_selection? : KeyPressPatterns, kill_line_tail? : KeyPressPatterns, kill_line_head? : KeyPressPatterns, yank? : KeyPressPatterns, yank_pop? : KeyPressPatterns, reverse_search? : KeyPressPatterns, paste? : KeyPressPatterns) -> KeyBindingspub struct KeyPressCallback {
pattern : KeyPressPattern
callback : async (PromptSnapshot) -> KeyPressCallbackResult
}fn KeyPressCallback::new(pattern : KeyPressPattern, callback : async (PromptSnapshot) -> KeyPressCallbackResult) -> KeyPressCallbackpub(all) enum KeyPressCallbackResult {
StayOnPrompt
SubmitPrompt(String)
}type KeyPressPatternfn KeyPressPattern::new(key : ConsoleKey, shift? : Bool, alt? : Bool, control? : Bool) -> KeyPressPatterntype KeyPressPatternstype Promptasync fn Prompt::new(console : &ConsolePort, clipboard : &ClipboardPort, configuration? : PromptConfiguration) -> Promptpub struct PromptCallbacks {
key_press_callbacks : Array[KeyPressCallback]
highlight_callback : async (PromptSnapshot) -> Array[FormatSpan]
completion_span_provider : async (PromptSnapshot) -> CompletionSpan
completion_items_provider : async (CompletionRequest) -> Array[CompletionItem]
should_open_completion_window : async (CompletionTriggerContext) -> Bool
transform_key_press : async (KeyTransformContext) -> KeyPress
confirm_completion_commit : async (CompletionCommitContext) -> Bool
should_insert_soft_newline : async (PromptSnapshot, KeyPress) -> Bool
format_input : async (FormatInputContext) -> (String, Int)
overload_provider : async (PromptSnapshot) -> (Array[OverloadItem], Int)
}impl Default for PromptCallbacksfn PromptCallbacks::new(key_press_callbacks? : Array[KeyPressCallback], highlight_callback? : async (PromptSnapshot) -> Array[FormatSpan], completion_span_provider? : async (PromptSnapshot) -> CompletionSpan, completion_items_provider? : async (CompletionRequest) -> Array[CompletionItem], should_open_completion_window? : async (CompletionTriggerContext) -> Bool, transform_key_press? : async (KeyTransformContext) -> KeyPress, confirm_completion_commit? : async (CompletionCommitContext) -> Bool, should_insert_soft_newline? : async (PromptSnapshot, KeyPress) -> Bool, format_input? : async (FormatInputContext) -> (String, Int), overload_provider? : async (PromptSnapshot) -> (Array[OverloadItem], Int)) -> PromptCallbackspub struct PromptConfiguration {
prompt : FormattedString
key_bindings : KeyBindings
history : HistoryConfiguration
callbacks : PromptCallbacks
selection_background : AnsiColor
use_colors : Bool
max_completion_items_count : Int
kill_ring_max_size : Int
}impl Default for PromptConfigurationfn PromptConfiguration::new(prompt? : FormattedString, key_bindings? : KeyBindings, history? : HistoryConfiguration, callbacks? : PromptCallbacks, selection_background? : AnsiColor, use_colors? : Bool, max_completion_items_count? : Int, kill_ring_max_size? : Int) -> PromptConfigurationpub struct PromptSnapshot {
text : String
caret : Int
}Install
Download zipA pretty prompt library for Moonbit, providing an easy way to create interactive command-line interfaces with customizable prompts and input handling.
Dependencies