diff --git a/examples/demo.sh b/examples/demo.sh index 42f708c..9e8aa9e 100755 --- a/examples/demo.sh +++ b/examples/demo.sh @@ -275,6 +275,42 @@ pipeline_filter_demo() { ITEMS } +# ── Phase 4 demos ──────────────────────────────────────── + +multi_select_basic() { + echo "Multi-select: toggle items with Space or Tab, confirm with Enter." >&2 + echo "Undo with u, redo with Ctrl+R, clear all with U." >&2 + echo "" >&2 + printf "apple\nbanana\ncherry\ndate\nelderberry\nfig\ngrape\nhoneydew\n" \ + | pikl --multi +} + +multi_select_packages() { + echo "Pick packages to install. Space to toggle, Enter to confirm." >&2 + echo "Try V to enter visual mode, then j/k to extend, Space to apply." >&2 + echo "" >&2 + cat <<'ITEMS' | pikl --multi --format '{label} - {sublabel}' +{"label": "ripgrep", "sublabel": "fast recursive grep"} +{"label": "fd", "sublabel": "find alternative"} +{"label": "bat", "sublabel": "cat with syntax highlighting"} +{"label": "eza", "sublabel": "modern ls replacement"} +{"label": "delta", "sublabel": "better git diff"} +{"label": "zoxide", "sublabel": "smarter cd"} +{"label": "starship", "sublabel": "cross-shell prompt"} +{"label": "tokei", "sublabel": "code line counter"} +{"label": "hyperfine", "sublabel": "benchmarking tool"} +{"label": "procs", "sublabel": "modern ps replacement"} +ITEMS +} + +multi_select_structured() { + echo "Multi-select with --structured output. Each selected item" >&2 + echo "is a JSON line with action and index fields." >&2 + echo "" >&2 + printf "alpha\nbravo\ncharlie\ndelta\necho\nfoxtrot\n" \ + | pikl --multi --structured +} + # ── Scenario menu ───────────────────────────────────────── scenarios=( @@ -297,6 +333,10 @@ scenarios=( "Handler hook (event logging)" "Handler hook (add items on hover)" "---" + "Multi-select (basic)" + "Multi-select (packages)" + "Multi-select (structured output)" + "---" "on-select-exec hook (legacy)" ) @@ -319,6 +359,9 @@ run_scenario() { *"Exec hooks"*) exec_hooks_demo ;; *"Handler hook (event"*) handler_hook_demo ;; *"Handler hook (add"*) handler_add_items_demo ;; + *"Multi-select (basic)"*) multi_select_basic ;; + *"Multi-select (pack"*) multi_select_packages ;; + *"Multi-select (struct"*) multi_select_structured ;; *"on-select-exec"*) on_select_hook ;; "---") echo "that's a separator, not a scenario" >&2