From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30455 invoked from network); 31 Dec 2021 22:19:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 Dec 2021 22:19:51 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1640989191; b=Re2oo9+cOxiavMFoBdPoTa2YcQg2fWvzk8YyiyKsxzVFm78N6aPz5c3xAudZOUc3KOeSQaWVbv Oq2dpvoZVimIp76JbTFkoqOi7r446cU33CDb0nEgJbxUUxxAnEJc1IuocrMAbFoyexOHSkYaki tU30dXgSRZFG/XjzOZraq/L3F35cjaZCSjHDY/YLkfZxx6oeDxwZT3ORrRlomYRWpp0PsF15Iq ZkDSWSPcdp5OJUrmoXUlQ8itDf3xJEffmfaO3P7wHG4PW6hubg17XROY7GvUcF17cE9ryfntix m71tRoNWSIwSal8QtxcXti4v/FT8BG1faw3GX+vycx8k8Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f52.google.com) smtp.remote-ip=209.85.221.52; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1640989191; bh=JxTPhO13QsViCzHh/Uw52GfOAKFk82cctbgMYxKpn1g=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:Subject:To:From:DKIM-Signature:DKIM-Signature; b=ibeXDIXprA2VDkDJfgqmBWVVToPmt4qEQkVr5yg59NrFHaudXdugjTGL8ULAtIDqs8H/pYwtc5 f6HsSklrY9ouOcVGnY88nYcRlpyUXkaKW0jkzN3XQq0mDxqJwI0hGcvYR6nnuTKKvaPTHzsoN+ IfaK2U3wv/hEm6mp+MC+1IM/8RT9zYnHoX0P2rtTpV9qtP14HMpGgcImPfeDOId6qkVPLvW2Ps +1ynEQIbEwEOvjg5c7Di1ObKOonciH500lBGhwp8k4m3D2w4Z87HFN+4zSJpGopFmr3+TgksId eSW6jBmUtNzqsbCvLYDlUSOxtOKdht8zf3eC2TQjssYryQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=gxMAHA2J2TTGP7jPzRMWRMcJfmJdT+H9YJzkj28WvCU=; b=UvgdrxVIcRBhSTb+3/hH4XJ7Vg ZWmM/b+KAtor4CwriK9Ge8I2D7fwz4IeLfIBBo2jCD3xiVzFQG2yIDdCx+bP+BMiY+byFVhXjVtdj HVZcTGynFLrXAr2HDdVA8QIORZVLB1eZIhzdkjLSFdnc92xiLiHDAKjcOpK6HTJexWwv7wirnv4Pf T1afhClXhagrP3T3cbQfVPF6q9qghz4Yg1qaVevjZrvshqsWNRJtuUa/kSnue2qgK6a8JlK4hNkRg TY26R9Aa7b9BVVpyvx4GW2YtCOO8vZ47YiCtFTVSOga+LUDRlErHmj7fp/RN+U6OCIQpbaT1Puur4 nxI+hvKA==; Received: from authenticated user by zero.zsh.org with local id 1n3QFZ-00047I-Ep; Fri, 31 Dec 2021 22:19:49 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f52.google.com) smtp.remote-ip=209.85.221.52; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wr1-f52.google.com ([209.85.221.52]:35711) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1n3QF0-0003mE-QP; Fri, 31 Dec 2021 22:19:15 +0000 Received: by mail-wr1-f52.google.com with SMTP id j18so57901578wrd.2 for ; Fri, 31 Dec 2021 14:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=gxMAHA2J2TTGP7jPzRMWRMcJfmJdT+H9YJzkj28WvCU=; b=R1irInJEZPvM5ord633Z1RDAiLlfevcmFO4tmXwp0z38HGC9fPErOOyB2WCgdykOaV oIfOis8hIYNHnlqTH7vlR5VXUxcUlQPxnI+bx08kwUS11SXbz5ywyWYyXev5/cNqjKlp GkH3/9sSdwhntpOFH0t/8sBOpvBExG1kfV5eAWs+9zRM2eF7IqHzcrcG/3DnPcJiF653 nWUUlWs/G77tjXxYMqEXP6AwpNw2XWHxMIPH3o6giI3eQaHEZLQBKO5ZZQLLgZ45SqjR 6DtvTem5U/3+bJew7j6Img9JyLEGeFuWTM9EMenGWJb5+vAZasRuvLvZyqCDSHLIw5rI mYUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=gxMAHA2J2TTGP7jPzRMWRMcJfmJdT+H9YJzkj28WvCU=; b=PGM2/s8toga9RTNJcOCowDDpxL5erO1/Nuq3R4GK+Zl4gPp8RX7o2jPFZjkZyIlfdJ lWSjUt8MKMQSmhfGaX1Un9hwQaFt4AtOI73HZ9PTc7g2/cIS2w8Qht30Nv5T+pCKOQhZ AX0LzfF/4FrWSZMbIBHbST1guebIyi0XbvCt7EEKOlpC3ys7eyvhS18i5TUTtxRxlK99 3nMQ6YnTdpVR4NRwOBmo6Vgnhrgo9ppqyyy4Oe6EEkCLePGarcMP1GzLY0lJcD+d/hUL ApgcuhImdx6D1beX1r40yAwc1DggxLudCxQlKGECFCEfX1OOKo6YLq7oN/O3Op+7ID9y H4/Q== X-Gm-Message-State: AOAM531khHMlJZM6+UGtPYCbHTm77ZmhxsKoii6u7AbUYTmDsMsu+M0B IS+QQfLlZgbHfbzwDpefHLwvJIZCtsjl3Q== X-Google-Smtp-Source: ABdhPJyCUU2Yft9cqXNrGqoH8mbP6uiTrcEUDaonS3unerwkYdLkq81HK7VyHb83TEXcbpcsPtdVAw== X-Received: by 2002:a05:6000:2a9:: with SMTP id l9mr30592130wry.71.1640989153862; Fri, 31 Dec 2021 14:19:13 -0800 (PST) Received: from new-pc.localnet ([46.7.20.46]) by smtp.gmail.com with ESMTPSA id a198sm27247718wmd.42.2021.12.31.14.19.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Dec 2021 14:19:13 -0800 (PST) From: Boyang Du To: zsh-workers@zsh.org Subject: PATCH: zargs - replace all "replace string" occurences in comand Date: Fri, 31 Dec 2021 22:19:13 +0000 Message-ID: <4365631.LvFx2qVVIh@new-pc> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart2221852.ElGaqSPkdT" Content-Transfer-Encoding: 7Bit X-Seq: 49669 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: This is a multi-part message in MIME format. --nextPart2221852.ElGaqSPkdT Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, I'm trying to use zargs as it provide nice features to avoid xargs + zsh -lic ... . However I found that if I use replace string, only one {} is replaced. e.g. zargs -i{} -- hi -- echo "{} and {} is okay" will output 'hi and {} is okay' with the change will output 'hi and hi is okay' diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs index ecd69f7e4..fff319fbf 100644 --- a/Functions/Misc/zargs +++ b/Functions/Misc/zargs @@ -291,7 +291,7 @@ do args=( "${(@)argv[1,end]}" ) shift $((end > ARGC ? ARGC : end)) if (( $#i )) - then call=( "${(@)command/$i/$args}" ) + then call=( "${(@)command//$i/$args}" ) else call=( "${(@)command}" "${(@)args}" ) fi if (( ${(c)#call} > s )) -- /****************** Best Regards Boyang Du ******************/ --nextPart2221852.ElGaqSPkdT Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="us-ascii"

Hi,

I'm trying to use zargs as it provide nice features to avoid xargs + zsh -lic ... .


However I found that if I use replace string, only one {} is replaced.

e.g.

zargs -i{} -- hi -- echo "{} and {} is okay" will output 'hi and {} is okay'

with the change will output 'hi and hi is okay'


diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs

index ecd69f7e4..fff319fbf 100644

--- a/Functions/Misc/zargs

+++ b/Functions/Misc/zargs

@@ -291,7 +291,7 @@ do

     args=( "${(@)argv[1,end]}" )

     shift $((end > ARGC ? ARGC : end))

     if (( $#i ))

-    then call=( "${(@)command/$i/$args}" )

+    then call=( "${(@)command//$i/$args}" )

     else call=( "${(@)command}" "${(@)args}" )

     fi

     if (( ${(c)#call} > s ))


--

/******************

Best Regards

Boyang Du

******************/

--nextPart2221852.ElGaqSPkdT--