module Opal
Overview
Opal: Next-generation TUI and CLI DSL framework for Crystal. Unifies The Elm Architecture (Bubbletea), Declarative Layout (Ink), and Low-Level Double-Buffered Terminal Diffing (Blessed).
Defined in:
opal.cropal/cli.cr
opal/cli/app.cr
opal/cli/argument.cr
opal/cli/command.cr
opal/cli/completion.cr
opal/cli/context.cr
opal/cli/help.cr
opal/cli/option.cr
opal/cli/parser.cr
opal/form.cr
opal/form/field.cr
opal/form/form.cr
opal/form/validator.cr
opal/input.cr
opal/input/autocomplete.cr
opal/input/fuzzy.cr
opal/input/key_map.cr
opal/input/mouse_map.cr
opal/input/text_input.cr
opal/prompt.cr
opal/prompt/ask.cr
opal/prompt/confirm.cr
opal/prompt/multi_select.cr
opal/prompt/progress.cr
opal/prompt/select.cr
opal/prompt/spinner.cr
opal/style.cr
opal/style/animation.cr
opal/style/border.cr
opal/style/color.cr
opal/style/layout.cr
opal/style/style.cr
opal/style/theme.cr
opal/style/visual_width.cr
opal/tea.cr
opal/tea/cmd.cr
opal/tea/model.cr
opal/tea/msg.cr
opal/tea/program.cr
opal/terminal.cr
opal/terminal/ansi_parser.cr
opal/terminal/driver.cr
opal/terminal/info.cr
opal/terminal/mock.cr
opal/terminal/osc.cr
opal/terminal/posix.cr
opal/terminal/raw_mode.cr
opal/terminal/screen.cr
opal/terminal/windows.cr
opal/ui.cr
opal/ui/buffer.cr
opal/ui/cell.cr
opal/ui/components/badge.cr
opal/ui/components/barchart.cr
opal/ui/components/box.cr
opal/ui/components/code_view.cr
opal/ui/components/command_palette.cr
opal/ui/components/filter_list.cr
opal/ui/components/gauge.cr
opal/ui/components/hex_viewer.cr
opal/ui/components/modal.cr
opal/ui/components/rule.cr
opal/ui/components/sparkline.cr
opal/ui/components/split_view.cr
opal/ui/components/stack.cr
opal/ui/components/table.cr
opal/ui/components/tabs.cr
opal/ui/components/text.cr
opal/ui/components/toast.cr
opal/ui/components/tree.cr
opal/ui/components/viewport.cr
opal/ui/diff_renderer.cr
opal/ui/dsl.cr
opal/ui/element.cr
opal/ui/markdown/renderer.cr
opal/version.cr
Constant Summary
-
VERSION =
"0.1.0"
Class Method Summary
-
.ask(question : String, default : String | Nil = nil, required : Bool = false) : String
Top-level Opal shortcuts
-
.autocomplete(&block : Input::Autocomplete -> Nil) : Input::Autocomplete
Convenience DSL to define an Autocomplete engine
-
.cli(name : String, version : String = "0.1.0", &block : CLI::App -> Nil) : CLI::App
Convenience DSL to define and configure a CLI application.
- .confirm(question : String, default : Bool = true) : Bool
-
.copy_to_clipboard(text : String, io : IO = STDOUT) : Nil
Copies text to the host system clipboard via OSC 52.
-
.filter(items : Array(String), title : String = "Filter Items", preview : Proc(String, String) | Nil = nil, driver : Terminal::Driver | Nil = nil) : String | Nil
High-level interactive filter prompt helper.
-
.form(title : String = "Form", &block : FormModule::Form -> Nil) : Hash(String, FormValue) | Nil
High-level entry point to declare and run an interactive form.
-
.hyperlink(text : String, url : String, id : String | Nil = nil) : String
Creates a clickable OSC 8 hyperlink for modern terminals.
-
.link(text : String, url : String, id : String | Nil = nil) : String
Alias for hyperlink
- .multi_select(question : String, options : Array(String), default_indices : Array(Int32) = [] of Int32) : Array(String)
-
.on_key(&block : Input::KeyMap -> Nil) : Input::KeyMap
Convenience DSL builder for key bindings
-
.on_mouse(&block : Input::MouseMap -> Nil) : Input::MouseMap
Convenience DSL builder for mouse routing
- .progress(total : Int32, bar_width : Int32 = 30, color : Color | Symbol | String = :cyan, title : String | Nil = nil, &block : Prompt::ProgressBar -> Nil) : Nil
-
.prompt_autocomplete(prompt : String = "> ", candidates : Array(String) = [] of String, driver : Terminal::Driver | Nil = nil, &block : Input::Autocomplete -> Nil) : String
Convenience DSL to prompt with tab autocomplete and ghost text
- .prompt_autocomplete(prompt : String = "> ", candidates : Array(String) = [] of String, driver : Terminal::Driver | Nil = nil) : String
-
.render_markdown(text : String, width : Int32 = 80) : String
Renders Markdown text directly to an ANSI formatted string.
-
.render_ui(width : Int32 = 80, height : Int32 = 24, &block : UI::Builder -> Nil) : String
Convenience shortcut to render a declarative UI tree
-
.run_tea(model : TEA::Model, driver : Terminal::Driver | Nil = nil, alt_screen : Bool = true) : TEA::Model
Convenience helper to instantiate and run a TEA Program
- .select(question : String, options : Array(String), default_index : Int32 = 0) : String
- .spinner(text : String, &block : Prompt::Spinner -> T) : T forall T
-
.style : Style
Convenience helper to create a new Style instance
-
.terminal : Terminal::Info
Returns terminal information object
-
.terminal(&block : Terminal::Info -> T) : T forall T
Executes a block with the terminal information DSL
-
.theme : Theme
Returns the current active Theme
-
.theme=(theme : Theme | Symbol | String) : Theme
Sets the current active Theme by symbol, string, or Theme instance
Class Method Detail
Top-level Opal shortcuts
Convenience DSL to define an Autocomplete engine
Convenience DSL to define and configure a CLI application.
Copies text to the host system clipboard via OSC 52.
High-level interactive filter prompt helper.
High-level entry point to declare and run an interactive form.
Creates a clickable OSC 8 hyperlink for modern terminals.
Convenience DSL builder for key bindings
Convenience DSL builder for mouse routing
Convenience DSL to prompt with tab autocomplete and ghost text
Renders Markdown text directly to an ANSI formatted string.
Convenience shortcut to render a declarative UI tree
Convenience helper to instantiate and run a TEA Program
Executes a block with the terminal information DSL
Sets the current active Theme by symbol, string, or Theme instance