Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Make a function name an alias for another function
- X-seq: zsh-users 27083
- From: Eric Smith <es@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Make a function name an alias for another function
- Date: Sat, 4 Sep 2021 18:42:32 +0200
- Archived-at: <https://zsh.org/users/27083>
- List-id: <zsh-users.zsh.org>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author