1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// pomprt, a line editor prompt library
// Copyright (c) 2023 rini
//
// SPDX-License-Identifier: Apache-2.0
//! A tiny and extensible readline implementation built from scratch
//!
//! Pomprt is a multi-line editor with support for things like syntax highlighting, hints and
//! completion.
//!
//! ## Usage
//!
//! For starters, you can create a prompt with [`prompt::new`][new], and read input via
//! [`Prompt::read`], or by iterating through it:
//!
//! ```
//! for input in pomprt::new(">> ") {
//! println!("{input}");
//! }
//! ```
//!
//! ### Custom editors
//!
//! For more complex applications, extra features can be added by implementing an [`Editor`]:
//!
//! ```
//! # struct MyEditor;
//! impl pomprt::Editor for MyEditor {
//! // Make the prompt cyan
//! fn highlight_prompt(&self, prompt: &str, _multiline: bool) -> String {
//! format!("\x1b[36m{prompt}")
//! }
//! }
//!
//! let mut cmd = pomprt::with(MyEditor, "><> ");
//! // ...
//! ```
//!
//! That's it! More complete examples can be found in the [`examples`] folder.
//!
//! [`examples`]: https://codeberg.org/rini/pomprt/src/branch/main/examples
//!
//! ## Crate features
//!
//! | Feature name | Description |
//! | ------------- | ----------- |
//! | `abort` | Enables [`Event::Abort`] (`C-\`), which triggers a coredump |
//! | `suspend` | Enables [`Event::Suspend`] (`C-z`), which sends `SIGTSTP` (Unix only) |
pub use ;
pub use ;
pub use ;
/// Construct a new [`Prompt`] with the default editor
pub const
/// Construct a new [`Prompt`] with a custom editor
pub const
/// Construct a new [`Prompt`] with a custom editor and multiline prompt
pub const