From 598c8c30728f9a23f104bba86cb23c7eb53035bb Mon Sep 17 00:00:00 2001 From: Mohamed Ragab <323062+mragab@users.noreply.github.com> Date: Thu, 27 Apr 2023 14:38:04 +0200 Subject: [PATCH] Update integration.md Simplify the snippet for listing and attaching to current sessions to a one-liner that still handles all cases by using `sk -0 -1`, which automatically exists in case there are no sessions, and in case there is only one session, it automatically selects it. --- docs/src/integration.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/src/integration.md b/docs/src/integration.md index fd2e102..b67cac6 100644 --- a/docs/src/integration.md +++ b/docs/src/integration.md @@ -66,15 +66,7 @@ Depends on [`sk`](https://github.com/lotabout/skim) & `bash` ``` #!/usr/bin/env bash -ZJ_SESSIONS=$(zellij list-sessions) -NO_SESSIONS=$(echo "${ZJ_SESSIONS}" | wc -l) - -if [ "${NO_SESSIONS}" -ge 2 ]; then - zellij attach \ - "$(echo "${ZJ_SESSIONS}" | sk)" -else - zellij attach -c -fi +zellij attach $(zellij list-sessions | sk -0 -1) -c ``` ## List layout files and create a layout