sql-cli 1.67.1

SQL query tool for CSV/JSON with both interactive TUI and non-interactive CLI modes - perfect for exploration and automation
Documentation
use ratatui::style::{Color, Modifier, Style};
use ratatui::text::Line;

/// Manages help text content for the TUI
/// Extracted from the monolithic `enhanced_tui.rs`
pub struct HelpText;

impl HelpText {
    /// Get the left column content for help display
    #[must_use]
    pub fn left_column() -> Vec<Line<'static>> {
        vec![
            Line::from("SQL CLI Help - Enhanced Features ๐Ÿš€").style(
                Style::default()
                    .fg(Color::Cyan)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from(""),
            Line::from("COMMAND MODE").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  Enter    - Execute query"),
            Line::from("  Tab      - Auto-complete"),
            Line::from("  F2       - Switch to Results mode"),
            Line::from("  Ctrl+R   - Search history"),
            Line::from("  Ctrl+P   - Previous command in history"),
            Line::from("  Ctrl+N   - Next command in history"),
            Line::from("  Alt+โ†‘    - Previous command (alternative)"),
            Line::from("  Alt+โ†“    - Next command (alternative)"),
            Line::from("  Ctrl+X   - Expand SELECT * to all columns"),
            Line::from("  Alt+X    - Expand SELECT * to visible columns only"),
            Line::from("  F3       - Show pretty-printed query"),
            Line::from(""),
            Line::from("NAVIGATION").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  Ctrl+A   - Beginning of line"),
            Line::from("  Ctrl+E   - End of line"),
            Line::from("  Ctrl+โ†   - Move backward word"),
            Line::from("  Ctrl+โ†’   - Move forward word"),
            Line::from("  Alt+B    - Move backward word (bash-style)"),
            Line::from("  Alt+F    - Move forward word (bash-style)"),
            Line::from(""),
            Line::from("EDITING").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  Ctrl+W   - Delete word backward"),
            Line::from("  Alt+D    - Delete word forward"),
            Line::from("  Ctrl+K   - Kill to end of line"),
            Line::from("  Ctrl+U   - Kill to beginning of line"),
            Line::from("  F9       - Kill to end (Ctrl+K alternative)"),
            Line::from("  F10      - Kill to beginning (Ctrl+U alternative)"),
            Line::from("  Ctrl+Y   - Yank (paste from kill ring)"),
            Line::from("  Ctrl+V   - Paste from system clipboard"),
            Line::from("  Ctrl+Z   - Undo"),
            Line::from("  Alt+[    - Jump to previous SQL token"),
            Line::from("  Alt+]    - Jump to next SQL token"),
            Line::from(""),
            Line::from("BUFFER MANAGEMENT (works in Command & Results modes)").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  F11           - Previous buffer"),
            Line::from("  Ctrl+PgUp     - Previous buffer (alternative)"),
            Line::from("  Ctrl+PgDn     - Next buffer"),
            Line::from("  Ctrl+6        - Quick switch (toggle last two)"),
            Line::from("  Alt+N         - New buffer"),
            Line::from("  Alt+W         - Close buffer"),
            Line::from("  Alt+B         - List buffers"),
            Line::from("  Alt+1-9       - Switch to buffer N"),
            Line::from(""),
            Line::from("VIEW MODES").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  F1/?     - Toggle this help"),
            Line::from("  F5       - Debug info"),
            Line::from("  F6       - Toggle row numbers"),
            Line::from("  F8       - Case-insensitive"),
            Line::from("  โ†“        - Enter results mode"),
            Line::from("  Ctrl+C/q - Exit"),
            Line::from(""),
            Line::from("๐ŸŒŸ FEATURES").style(
                Style::default()
                    .fg(Color::Magenta)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  โ€ข Column statistics (S key)"),
            Line::from("  โ€ข Column pinning (p/P keys)"),
            Line::from("  โ€ข Dynamic column sizing"),
            Line::from("  โ€ข Compact mode (C key)"),
            Line::from("  โ€ข Rainbow parentheses"),
            Line::from("  โ€ข Auto-execute CSV/JSON"),
            Line::from("  โ€ข Multi-source indicators"),
            Line::from("  โ€ข LINQ-style null checking"),
            Line::from("  โ€ข Row numbers (N key)"),
            Line::from("  โ€ข Jump to row (: key)"),
        ]
    }

    /// Get the right column content for help display
    #[must_use]
    pub fn right_column() -> Vec<Line<'static>> {
        vec![
            Line::from("Use โ†“/โ†‘ or j/k to scroll help").style(Style::default().fg(Color::DarkGray)),
            Line::from(""),
            Line::from("RESULTS NAVIGATION").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  j/โ†“      - Next row"),
            Line::from("  k/โ†‘      - Previous row"),
            Line::from("  h/โ†      - Previous column"),
            Line::from("  l/โ†’      - Next column"),
            Line::from("  5j       - โšก Move down 5 rows (vim counts)"),
            Line::from("  3k       - โšก Move up 3 rows (vim counts)"),
            Line::from("  10l      - โšก Move right 10 columns"),
            Line::from("  g        - First row"),
            Line::from("  G        - Last row"),
            Line::from("  H        - Top of viewport"),
            Line::from("  M        - Middle of viewport"),
            Line::from("  L        - Bottom of viewport"),
            Line::from("  0/^      - First column"),
            Line::from("  $        - Last column"),
            Line::from("  PgDn     - Page down"),
            Line::from("  PgUp     - Page up"),
            Line::from(""),
            Line::from("RESULTS FEATURES").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  C        - ๐ŸŽฏ Toggle compact (binary on/off)"),
            Line::from("  Alt+S    - ๐Ÿ“ Cycle column packing"),
            Line::from("             (Balanced โ†’ Data Focus โ†’ Header Focus)"),
            Line::from("  N        - ๐Ÿ”ข Toggle row nums"),
            Line::from("  :        - ๐Ÿ“ Jump to row"),
            Line::from("  Space    - ๐Ÿ”’ Toggle viewport lock"),
            Line::from("  Ctrl+Space - ๐Ÿ”’ Toggle viewport lock (alternative)"),
            Line::from("  x/X      - ๐Ÿ”’ Toggle cursor lock"),
            Line::from("  p        - ๐Ÿ“Œ Pin/unpin column"),
            Line::from("  P        - Clear all pins"),
            Line::from("  -        - ๐Ÿ‘๏ธ Hide current column"),
            Line::from("  e/E      - ๐Ÿ‘๏ธ Hide empty columns"),
            Line::from("  +/=      - ๐Ÿ‘๏ธ Unhide all columns"),
            Line::from("  <        - โ†”๏ธ Move column left"),
            Line::from("  >        - โ†”๏ธ Move column right"),
            Line::from("  /        - ๐Ÿ” Vim search (type, Enter to confirm)"),
            Line::from("  n        - Next search match"),
            Line::from("  N        - Previous search match"),
            Line::from("  \\        - Search column names"),
            Line::from("  Shift+F  - Filter rows (regex)"),
            Line::from("  f        - Fuzzy filter rows"),
            Line::from("  'text    - Exact match filter"),
            Line::from("             (matches highlighted)"),
            Line::from("  v        - Toggle cell/row mode"),
            Line::from("  s        - Sort by column"),
            Line::from("  S        - ๐Ÿ“Š Column statistics"),
            Line::from("  y        - Yank (cell mode: yank cell)"),
            Line::from("    yy     - Yank current row (row mode)"),
            Line::from("    yc     - Yank current column"),
            Line::from("    yv     - Yank current cell (any mode)"),
            Line::from("    ya     - Yank all data"),
            Line::from("    yq     - Yank current query"),
            Line::from("  c        - SQL clause navigation:"),
            Line::from("    cw     - Jump to WHERE clause"),
            Line::from("    cs     - Jump to SELECT clause"),
            Line::from("    cf     - Jump to FROM clause"),
            Line::from("    co     - Jump to ORDER BY"),
            Line::from("    cg     - Jump to GROUP BY"),
            Line::from("    ch     - Jump to HAVING clause"),
            Line::from("    cl     - Jump to LIMIT clause"),
            Line::from("  i/F2/Esc - Back to command (i=vim insert)"),
            Line::from("  q        - Quit"),
            Line::from(""),
            Line::from("EXPORT DATA ๐Ÿ“ค").style(
                Style::default()
                    .fg(Color::Green)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  Ctrl+E   - Export to CSV file"),
            Line::from("  Ctrl+J   - Export to JSON file"),
            Line::from("           (files saved with timestamp)"),
            Line::from(""),
            Line::from("SEARCH/FILTER").style(
                Style::default()
                    .fg(Color::Yellow)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  Enter    - Apply"),
            Line::from("  Esc      - Cancel"),
            Line::from(""),
            Line::from("DEBUG MODE (F5)")
                .style(Style::default().fg(Color::Red).add_modifier(Modifier::BOLD)),
            Line::from("  g/G      - Go to top/bottom"),
            Line::from("  j/k      - Scroll up/down"),
            Line::from("  PgUp/Dn  - Page up/down"),
            Line::from("  Ctrl+T   - Yank as test case โœจ"),
            Line::from("  Shift+Y  - Yank debug context โœจ"),
            Line::from("  Esc/q    - Exit debug mode"),
            Line::from(""),
            Line::from("๐Ÿ’ก TIPS").style(
                Style::default()
                    .fg(Color::Green)
                    .add_modifier(Modifier::BOLD),
            ),
            Line::from("  โ€ข Load CSV: sql-cli data.csv"),
            Line::from("  โ€ข Press C for compact view"),
            Line::from("  โ€ข Press N for row numbers"),
            Line::from("  โ€ข Press : then 200 โ†’ row 200"),
            Line::from("  โ€ข Vim counts: 5j, 10k, 3h, 7l"),
            Line::from("  โ€ข Press 'i' for vim-style insert"),
            Line::from("  โ€ข cw/cs/cf = jump to SQL clauses"),
            Line::from("  โ€ข Space locks viewport"),
            Line::from("  โ€ข Columns auto-adjust width"),
            Line::from("  โ€ข f + 'ubs = exact 'ubs' match"),
            Line::from("  โ€ข \\ + name = find column by name"),
            Line::from("  โ€ข F5 + Ctrl+T = Auto-generate tests!"),
            Line::from(""),
            Line::from("๐Ÿ“ File ๐ŸŒ API ๐Ÿ—„๏ธ SQL ๐Ÿงช Test"),
        ]
    }
}