From 29833dbe7fbf1e0fc6eb9cb45ba0716de0ed5317 Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Tue, 8 Aug 2023 08:13:31 +0200 Subject: [PATCH] =?utf8?q?Utworzenie=20funkcji=20'doInContainers'=20pozwal?= =?utf8?q?aj=C4=85c=C4=85=20uruchomi=C4=87=20podan=C4=85=20funkcj=C4=99=20?= =?utf8?q?dla=20wszystkich=20lub=20jednego=20wybranego?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- idle-clis | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/idle-clis b/idle-clis index 5632132..9f97737 100755 --- a/idle-clis +++ b/idle-clis @@ -6,6 +6,20 @@ ENDCOLOR="\e[0m"; YES="\u2714"; NO="\u2716"; +function doInContainers() { + containerName=$1; + fn=$2; + shift 2; + if [ "$containerName" = "--all" ]; then + containerList=$(idle-list-containers | awk '{printf $1" "}' | sed 's/://g'); + for containerName in $containerList; do + $fn $containerName $2; + done + else + $fn $containerName $2; + fi +} + function ckcmd() { cmd=$2; idle-exec-command $1 $cmd > /dev/null 2>&1; @@ -14,6 +28,7 @@ function ckcmd() { fi } + if [ $# -gt 0 ]; then source /usr/local/bin/idle; command=$1; @@ -23,15 +38,8 @@ if [ $# -gt 0 ]; then "shell") idle-exec-shell $2; exit;; "check-command") containerName=$1; - if [ "$containerName" = "--all" ]; then - containerList=$(idle-list-containers | awk '{printf $1" "}' | sed 's/://g'); - for containerName in $containerList; do - ckcmd $containerName $2; - done - else - ckcmd $containerName $2; - fi - exit;; + doInContainers $containerName ckcmd $@; + exit;; "apropos") idle-apropos $@; exit;; "pkgsearch") idle-pkg-search $@; break;; esac -- 2.39.5