micha / resty

Little command line REST client that you can use in pipelines (bash or zsh).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resty not loading in Shell

bewheele opened this issue · comments

I'm following the git instructions, but I am unable to successfully load resty in the shell on a Mac. I wanted to ask if I'm mis-understanding the source syntax

When trying to execute the following script, it seems resty takes no action (there are no errors being thrown on the target server), nor in the Terminal

I've installed resty via the git install method. The same POST command works on a single file I execute in the shell via resty (so I know resty is correctly added to my Path, and I know the command syntax is good...)

Also - the script below works to upload all files in the referenced folder if I replace the resty line with a curl command - it's just the resty source part that seems not to work.

Any help appreciated - I'd much prefer resty to using straight curl syntax!

#!/bin/bash
dir="/Users/bewheele/Downloads/Images"
 for file in `find $dir -type f`
  do
  filename=`basename $file`;
  echo $file
   # Load resty, don't write to the history file, and set the URI base
  . /Users/bewheele/resty -W 'http://localhost:4504 -u admin:admin' POST /api/assets/myfolder/* -F"name=$filename" -F"file=@$file"
done

Try to expand aliases in the shell.
This works for me.

#!/bin/bash
shopt -s expand_aliases

Ref: #87