example: Add IPC remote control example.
This commit is contained in:
@@ -379,6 +379,35 @@ Gentoo,rolling,openrc
|
||||
CSV
|
||||
}
|
||||
|
||||
# ── Phase 6 demos ────────────────────────────────────────
|
||||
|
||||
ipc_demo() {
|
||||
echo "IPC demo: pikl runs here with --ipc enabled." >&2
|
||||
echo "Open a second terminal and run:" >&2
|
||||
echo " ./examples/ipc-remote.sh demo" >&2
|
||||
echo "" >&2
|
||||
echo "Use the remote to navigate, filter, add items, and query state." >&2
|
||||
echo "Press Enter or q in the remote to exit." >&2
|
||||
echo "" >&2
|
||||
cat <<'ITEMS' | pikl --ipc --session demo --multi
|
||||
{"label": "Arch Linux", "category": "rolling", "init": "systemd"}
|
||||
{"label": "NixOS", "category": "rolling", "init": "systemd"}
|
||||
{"label": "Void Linux", "category": "rolling", "init": "runit"}
|
||||
{"label": "Debian", "category": "stable", "init": "systemd"}
|
||||
{"label": "Alpine", "category": "stable", "init": "openrc"}
|
||||
{"label": "Fedora", "category": "semi-rolling", "init": "systemd"}
|
||||
{"label": "Gentoo", "category": "rolling", "init": "openrc"}
|
||||
ITEMS
|
||||
}
|
||||
|
||||
session_demo() {
|
||||
echo "Session filter history: select with a filter, exit, relaunch." >&2
|
||||
echo "Press Ctrl+P to recall your previous filter." >&2
|
||||
echo "" >&2
|
||||
printf "apple\nbanana\ncherry\ndate\nelderberry\nfig\ngrape\nhoneydew\n" \
|
||||
| pikl --session fruit
|
||||
}
|
||||
|
||||
# ── Scenario menu ─────────────────────────────────────────
|
||||
|
||||
scenarios=(
|
||||
@@ -411,6 +440,9 @@ scenarios=(
|
||||
"CSV + multi-select"
|
||||
"CSV + field filter"
|
||||
"---"
|
||||
"IPC remote control"
|
||||
"Session filter history"
|
||||
"---"
|
||||
"on-select-exec hook (legacy)"
|
||||
)
|
||||
|
||||
@@ -441,6 +473,8 @@ run_scenario() {
|
||||
*"CSV with --columns"*) csv_columns_alias ;;
|
||||
*"CSV + multi"*) csv_multi_select ;;
|
||||
*"CSV + field"*) csv_filter ;;
|
||||
*"IPC remote"*) ipc_demo ;;
|
||||
*"Session filter"*) session_demo ;;
|
||||
*"on-select-exec"*) on_select_hook ;;
|
||||
"---")
|
||||
echo "that's a separator, not a scenario" >&2
|
||||
|
||||
Reference in New Issue
Block a user