zsh-users
 help / color / mirror / code / Atom feed
* execute or print one-liner
@ 2022-11-30 14:10 Thomas Lauer
  2022-11-30 16:18 ` Philippe Altherr
  2022-11-30 16:38 ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Lauer @ 2022-11-30 14:10 UTC (permalink / raw)
  To: Zsh-Users List

Hi folks,

I have dozens, if not hundreds, of one-liners, many as aliases and many
others as simple one-line functions (used whenever some parameters need
a little massaging before execution). That's working very well.

I have early on stumbled across a zsh function that would expand an
alias on the command line so that I can edit or add stuff and I use that
for many aliases. However, I just can't find a similar thing for
one-line functions, ie a function that will just print the one-line
function body to the command line but not execute it. Given

f1() { blahblah -o1 -o2 $1 -o3 $2 $3 }

executing f1() with three parameters is simple:

f1 a b c

What I'm looking for is a way to have f1's body injected into the
command line, ie something akin to

print -z blahblah -o1 -o2 -o3

($1-$3 will be empty as they are undefined.)

I can write a second function print-z-ing the required string but that
feels redundant... although I have no idea how to do this w/o such a
function.

Anyone got an idea?

Thanks T


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-30 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 14:10 execute or print one-liner Thomas Lauer
2022-11-30 16:18 ` Philippe Altherr
2022-11-30 16:38 ` Peter Stephenson
2022-11-30 17:32   ` Thomas Lauer

Code repositories for project(s) associated with this public 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).