diff options
| author | Mathieu Ablasou <alexherbo2@gmail.com> | 2021-02-03 17:51:58 +0100 |
|---|---|---|
| committer | Mathieu Ablasou <alexherbo2@gmail.com> | 2021-02-03 17:51:58 +0100 |
| commit | 09661989333b07f31c74b8cd3a0ec8db55a28718 (patch) | |
| tree | 7fe6006a5c6400e82e37aaae9848e7535bcbebd3 /bin/kak-shell | |
| parent | a60a3f0741c7fd8eb4acb0c103c08dd1b98f634f (diff) | |
Allow to connect to a session without a prompt
Closes #52
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() { |
