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
//! Scott's Own Editor — a built-in TUI text editor for CLI tools.
//!
//! Provides a single entry point that resolves the best available editor
//! using Git's precedence (`$GIT_EDITOR` → `core.editor` → `$VISUAL` →
//! `$EDITOR`) and falls back to a built-in TUI editor when none is configured.
//!
//! ```no_run
//! // One call — handles external editors and built-in fallback automatically
//! let result = soe::capture("Enter your message (lines starting with # are ignored)")?;
//!
//! // Or with pre-filled content
//! let result = soe::capture_with_initial("Edit the description", "existing text here")?;
//!
//! // Direct access to the built-in TUI editor
//! let result = soe::edit("filename", "initial content", soe::EditorMode::PlainText)?;
//! # Ok::<(), anyhow::Error>(())
//! ```
pub use ;
pub use EditorMode;
/// Open the built-in TUI editor with initial content.
///
/// - `filename` is shown in the UI (doesn't touch disk).
/// - `initial_content` is pre-loaded into the buffer.
/// - `mode` controls wrapping and guide lines.
///
/// Returns `Some(content)` if the user saved, `None` if cancelled.
/// Open the built-in editor for a file on disk.
///
/// Reads the file (or starts empty if it doesn't exist), lets the user
/// edit, and writes it back on save.