zsh-users
 help / color / mirror / code / Atom feed
* Make a function name an alias for another function
@ 2021-09-04 16:21 Eric Smith
  2021-09-04 16:24 ` Roman Perepelitsa
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Smith @ 2021-09-04 16:21 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Make a function name an alias for another function
@ 2021-09-04 16:42 Eric Smith
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Smith @ 2021-09-04 16:42 UTC (permalink / raw)
  To: zsh-users

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


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

end of thread, other threads:[~2021-09-05 19:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04 16:21 Make a function name an alias for another function Eric Smith
2021-09-04 16:24 ` Roman Perepelitsa
2021-09-05  5:00   ` Make a function name an alias for another function [SOLVED] Eric Smith
2021-09-05 19:01     ` Bart Schaefer
2021-09-04 16:42 Make a function name an alias for another function Eric Smith

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