Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Suggestions for autogenerating function names to wrap the same code?
- X-seq: zsh-users 27600
- From: Steve Dondley <s@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Suggestions for autogenerating function names to wrap the same code?
- Date: Tue, 22 Mar 2022 16:52:54 -0400
- Archived-at: <https://zsh.org/users/27600>
- List-id: <zsh-users.zsh.org>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author