diff options
Diffstat (limited to 'bin/kak-shell')
| -rwxr-xr-x | bin/kak-shell | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/bin/kak-shell b/bin/kak-shell index 2bf8bd5..d286626 100755 --- a/bin/kak-shell +++ b/bin/kak-shell @@ -1,10 +1,37 @@ #!/bin/sh +# Usage: +# +# kak-shell [session] [commands] +# +# Example – Basic: +# +# kak-shell +# +# Example – Connect to a session from the command-line and attach: +# +# kak-shell kanto :attach +# +# Example – Connect to a session interactively and attach: +# +# kak-shell '' :attach main() { - prompt_kakoune_session - [ "$text" ] || exit 1 + # Session + session=$1 + shift + + # Shell commands + commands=$@ + + # Prompt for a Kakoune session + if test -z "$session"; then + prompt_kakoune_session + [ "$text" ] || exit 1 + session=$text + fi - connect "$text" "$@" + # Connect to the given session and execute the shell commands + connect "$session" "$@" } connect() { |
