Created
November 6, 2013 05:40
-
-
Save akiko-pusu/7331473 to your computer and use it in GitHub Desktop.
RedmineからチケットをPDFで一括ダウンロード (API & sh) ref: http://qiita.com/akiko-pusu/items/e890fe59a9f74d57ff94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
USAGE="usage: $0 [REDMINE_URL] [PROJECT_ID] [API_KEY]" | |
if [ $# -lt 3 ]; then | |
echo >&2 $USAGE | |
exit 1 | |
fi | |
REDMINE_URL=$1 | |
PROJECT_ID=$2 | |
API_KEY=$3 | |
echo wget --content-disposition $REDMINE_URL/projects/$PROJECT_ID/issues.csv?key=$API_KEY&status_id=* | |
wget -nv --content-disposition $REDMINE_URL/projects/$PROJECT_ID/issues.csv?key=$API_KEY&status_id=* | |
# CSVが取得できるまで待ちましょう | |
wait | |
IFS="," | |
while read f1 f2 | |
do | |
if [ "$f1" != "#" ]; then | |
echo "IssueID: $f1" | |
wget -nv --content-disposition $REDMINE_URL/issues/${f1}.pdf?key=$API_KEY --output-document=${f1}.pdf | |
fi | |
done < issues.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment