From fff04d5a4aa157bb2ca6c259dd191eac51b62951 Mon Sep 17 00:00:00 2001 From: Yaohan Chen Date: Tue, 1 Apr 2014 12:56:00 -0400 Subject: Support passing additional PhantomJS options --- hib-dlagent | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'hib-dlagent') 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 Directory for searching and saving files. The normal save location - is still used, but will be a symbolic link - -h This help - -k Search key's files. Use multiple times for multiple keys - -o Name to use when saving file - -p Use pass to login. If specified multiple times, the last is used - -P The name of the password available via gnome-keyring-query - -s Print URL to stdout instead of downloading. Incompatible with -d - -u Use user to login. Search account's files. If specified multiple - times, the last is used - -S Directory where PhantomJs scripts are located. - -c Directory where configuration files are located. + -d Directory for searching and saving files. The normal save location + is still used, but will be a symbolic link + -h This help + -k Search key's files. Use multiple times for multiple keys + -o Name to use when saving file + -p Use pass to login. If specified multiple times, the last is used + -P The name of the password available via gnome-keyring-query + -s Print URL to stdout instead of downloading. Incompatible with -d + -u Use user to login. Search account's files. If specified multiple + times, the last is used + -S Directory where PhantomJS scripts are located. + -c Directory where configuration files are located. + -j 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 -- cgit v1.2.3-70-g09d2