zsh-users
 help / color / mirror / code / Atom feed
* Suggestions for autogenerating function names to wrap the same code?
@ 2022-03-22 20:52 Steve Dondley
  2022-03-22 21:03 ` Peter Stephenson
  2022-03-22 21:03 ` Mikael Magnusson
  0 siblings, 2 replies; 8+ messages in thread
From: Steve Dondley @ 2022-03-22 20:52 UTC (permalink / raw)
  To: zsh-users

So I have these two functions:

function task() {
    task_wrapper.pl $funcstack[1] "$@"
}

function tc() {
    task_wrapper.pl $funcstack[1] "$@“

}

They are both wrappers for the same perl script which does its thing based on the value of $funcstack[1];

Works, but I’m wondering if I can spare myself the job remembering to create a new function for each and every new perl function I want to write.

I could write a little script to pull out the subroutine names from the perl script and dump them into a file sourced by zsh and then reload zsh.

Wondering if there might be some cool feature of zsh I don’t know about to assist with creating these functions on-the-fly.



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

end of thread, other threads:[~2022-03-22 23:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 20:52 Suggestions for autogenerating function names to wrap the same code? Steve Dondley
2022-03-22 21:03 ` Peter Stephenson
2022-03-22 21:03 ` Mikael Magnusson
2022-03-22 21:09   ` Steve Dondley
2022-03-22 23:37     ` Steve Dondley
2022-03-22 21:16   ` Bart Schaefer
2022-03-22 23:28   ` Steve Dondley
2022-03-22 23:44     ` Steve Dondley

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).