From: Eric Smith <es@trustfood.org>
To: zsh-users@zsh.org
Subject: Make a function name an alias for another function
Date: Sat, 4 Sep 2021 18:42:32 +0200 [thread overview]
Message-ID: <20210904164232.dmd2z4jiin7rsf5k@trustfood.org> (raw)
Hey zsh-ers,
I would like to have a function defined in one place.
POST() {curl --silent -X $0 -H "Content-Type: application/json" http://admin:3/api/$@ | jq '.'}
GET() {curl --silent -X $0 -H "Content-Type: application/json" http://admin:3/api/$@ | jq '.'}
DELETE() {curl --silent -X $0 -H "Content-Type: application/json" http://admin:3/api/$@ | jq '.'}
Not three like this.
How can I make like
POST() = GET()
Then I can call GET() and it will run the same function but return of cause an alternate $0
Thanks for any tips.
Best wishes
Eric
next reply other threads:[~2021-09-04 16:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-04 16:42 Eric Smith [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-04 16:21 Eric Smith
2021-09-04 16:24 ` Roman Perepelitsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210904164232.dmd2z4jiin7rsf5k@trustfood.org \
--to=es@trustfood.org \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).