bin/split-man

22 lines
547 B
Bash
Executable File

#!/usr/bin/env bash
# Check if gum is available
if ! test -x "$(command -v gum)"; then
echo "Missing dependency: gum"
echo "See https://github.com/charmbracelet/gum"
exit 1
fi
CMD=$(gum input --placeholder="command")
if [[ -n "$BYOBU_BACKEND" && "$BYOBU_BACKEND" = "tmux" ]]; then
byobu-tmux split-window -h man "$CMD"
elif [[ -n "$TMUX" ]]; then
tmux split-window -h man "$CMD"
elif [[ -n "$ZELLIJ" ]]; then
zellij action new-pane -- man "$CMD"
else
echo "No byobu, tmux, or Zellij sessions detected"
exit 1
fi