zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: zargs - replace all "replace string" occurences in comand
@ 2021-12-31 22:19 Boyang Du
  0 siblings, 0 replies; only message in thread
From: Boyang Du @ 2021-12-31 22:19 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

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
******************/

[-- Attachment #2: Type: text/html, Size: 2977 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-31 22:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 22:19 PATCH: zargs - replace all "replace string" occurences in comand Boyang Du

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).