define-command -docstring %{ sh [switches] : Run the given shell command. Display its output in an info modal. Switches: -d echo stdout to *debug* buffer } -params 1.. sh %{ evaluate-commands %sh{ if [ "$1" = "-d" ]; then debug="true" shift fi stdout="$(eval "$@")" printf 'info -title sh "%s"\n' "$stdout" if [ "$debug" = "true" ]; then printf 'echo -debug -- "%s"\n' "$stdout" fi } }