summaryrefslogtreecommitdiff
path: root/hib-dlagent
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2014-04-01 12:56:00 -0400
committerYaohan Chen <yaohan.chen@gmail.com>2014-04-01 12:57:15 -0400
commitfff04d5a4aa157bb2ca6c259dd191eac51b62951 (patch)
tree46cb504b37156cefb6dfc6c2fef87f84166f915f /hib-dlagent
parentc453cfad478d4a00e9e84780d4738e84ac360d4d (diff)
downloadhib-dlagent-fff04d5a4aa157bb2ca6c259dd191eac51b62951.tar.gz
hib-dlagent-fff04d5a4aa157bb2ca6c259dd191eac51b62951.zip
Support passing additional PhantomJS options
Diffstat (limited to 'hib-dlagent')
-rwxr-xr-xhib-dlagent36
1 files changed, 21 insertions, 15 deletions
diff --git a/hib-dlagent b/hib-dlagent
index a90bdea..9dda7dd 100755
--- a/hib-dlagent
+++ b/hib-dlagent
@@ -19,8 +19,10 @@ STORAGE=
discover_url() {
local LISTING_PAGE="$1"
- phantomjs --config="$CONFIG_PATH"/phantomjs-config.json --cookies-file="$COOKIE_JAR" \
- "$SCRIPT_PATH"/discover-url.coffee "$LISTING_PAGE" "$FILE" "$USERNAME" "$PASSWORD"
+ # Running a new shell in order to split PHANTOM_JS_OPTIONS into multiple arguments
+ sh -c "phantomjs --config='$CONFIG_PATH'/phantomjs-config.json --cookies-file='$COOKIE_JAR' \
+ $PHANTOM_JS_OPTIONS \
+ '$SCRIPT_PATH'/discover-url.coffee '$LISTING_PAGE' '$FILE' '$USERNAME' '$PASSWORD'"
}
usage() {
@@ -30,18 +32,19 @@ Tool to download Humble Indie Bundle binaries by file name
Usage: $0 [OPTIONS] FILE
Options:
- -d <dir> Directory for searching and saving files. The normal save location
- is still used, but will be a symbolic link
- -h This help
- -k <key> Search key's files. Use multiple times for multiple keys
- -o <file> Name to use when saving file
- -p <pass> Use pass to login. If specified multiple times, the last is used
- -P <pname> The name of the password available via gnome-keyring-query
- -s Print URL to stdout instead of downloading. Incompatible with -d
- -u <user> Use user to login. Search account's files. If specified multiple
- times, the last is used
- -S <dir> Directory where PhantomJs scripts are located.
- -c <dir> Directory where configuration files are located.
+ -d <dir> Directory for searching and saving files. The normal save location
+ is still used, but will be a symbolic link
+ -h This help
+ -k <key> Search key's files. Use multiple times for multiple keys
+ -o <file> Name to use when saving file
+ -p <pass> Use pass to login. If specified multiple times, the last is used
+ -P <pname> The name of the password available via gnome-keyring-query
+ -s Print URL to stdout instead of downloading. Incompatible with -d
+ -u <user> Use user to login. Search account's files. If specified multiple
+ times, the last is used
+ -S <dir> Directory where PhantomJS scripts are located.
+ -c <dir> Directory where configuration files are located.
+ -j <options> Additional options passed to PhantomJS
If you specify -u, then all of that account's bundles are searched. If a key is
associated with a HIB account then you must use -u/-p, since that key only works
@@ -96,7 +99,7 @@ main() {
exit 1
fi
- while getopts "hd:k:o:p:P:su:S:c:" opt; do
+ while getopts "hd:k:o:p:P:su:S:c:j:" opt; do
case $opt in
\?)
exit 1
@@ -132,6 +135,9 @@ main() {
c)
CONFIG_PATH="$OPTARG"
;;
+ j)
+ PHANTOM_JS_OPTIONS="$OPTARG"
+ ;;
esac
done