Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Make a function name an alias for another function



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