diff options
| author | Petter Rasmussen | 2013-11-04 22:10:03 +0100 | 
|---|---|---|
| committer | Petter Rasmussen | 2013-11-04 22:10:03 +0100 | 
| commit | 596423476a61824b5888d0f6c476b3bcc78a2146 (patch) | |
| tree | 9741f098f5684199822e6cd3e4627167958ceec8 | |
| parent | e4c30fa0faed04287e0e64a4ce70d6f697f25322 (diff) | |
| download | gdrive-596423476a61824b5888d0f6c476b3bcc78a2146.tar.bz2 | |
Print markdown links
| -rwxr-xr-x | upload.sh | 19 | 
1 files changed, 18 insertions, 1 deletions
| @@ -1,5 +1,22 @@  #!/bin/bash +# Markdown helpers +HEADER='### Downloads' +ROW_TEMPLATE='- [{{name}}]({{url}})' + +# Grab application version +VERSION=$(bin/drive-darwin-amd64 --version | awk '{print $2}' | sed -e 's/v//') + +# Print markdown header +echo "$HEADER" +  for bin_path in bin/drive-*; do -    drive upload --file $bin_path --share | re -d ": " "File '([^']+)' .+(http.+)" +    # Upload file +    URL=$(drive upload --file $bin_path --share | awk '/https/ {print $9}') + +    # Render markdown row and print to screen +    NAME="$(basename $bin_path) v${VERSION}" +    ROW=${ROW_TEMPLATE//"{{name}}"/$NAME} +    ROW=${ROW//"{{url}}"/$URL} +    echo "$ROW"  done | 
