diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-07-02 16:12:29 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-07-02 16:14:34 +0200 |
commit | 8b5dcb5e0beb82766d587e38e53790ff2952bce7 (patch) | |
tree | d86baeba68a7a1ffa3f3850550187f897031a1a9 /scripts/generate_batch_reports.sh | |
parent | 53af877a1ac5e9777f0a78b8ee1779b918b695ec (diff) | |
download | sonarqube-8b5dcb5e0beb82766d587e38e53790ff2952bce7.tar.gz sonarqube-8b5dcb5e0beb82766d587e38e53790ff2952bce7.zip |
add command line options to generate_batch_reports.sh
Diffstat (limited to 'scripts/generate_batch_reports.sh')
-rwxr-xr-x | scripts/generate_batch_reports.sh | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/scripts/generate_batch_reports.sh b/scripts/generate_batch_reports.sh index 605839fc895..4bdd00fd97f 100755 --- a/scripts/generate_batch_reports.sh +++ b/scripts/generate_batch_reports.sh @@ -39,7 +39,24 @@ function createPrivateClone() { cd ${BUILD_DIR}${RELATIVE_PATH} } -DUMP_DIR="/tmp/batch_dumps" +function showHelp() { + echo "Usage: $0 -d DIR_PATH [ -l integer ] [ -h URL ] [ -u string ] [ -p string ]" + echo " -d : path to directory where batch report bumpds will be created" + echo " -l : number of commit in the past (optional: default is $HISTORY_LENGTH)" + echo " -h : URL of the SQ instance (optional: default is $SONAR_HOST)" + echo " -u : username to authentication on the SQ instance (optional: default is $SONAR_USER)" + echo " -p : password to authentication on the SQ instance (optional: default is $SONAR_USER)" +} + +function checkOptions() { + if [ "$DUMP_DIR" = "" ]; then + >&2 echo "-d option is mandatory" + showHelp + exit 1 + fi +} + +DUMP_DIR="" HISTORY_LENGTH=30 SONAR_HOST="http://localhost:9000" SONAR_USER="admin" @@ -48,6 +65,32 @@ SONAR_JDBC_URL="jdbc:postgresql://localhost:5432/sonar" SONAR_JDBC_USERNAME="sonar" SONAR_JDBC_PASSWORD="sonar" +while getopts ":d:l:h:u:p:" opt; do + case "$opt" in + d) DUMP_DIR=$OPTARG + ;; + l) HISTORY_LENGTH=$OPTARG + ;; + h) SONAR_HOST=$OPTARG + ;; + u) SONAR_USER=$OPTARG + ;; + p) SONAR_PASSWORD=$OPTARG + ;; + :) + >&2 echo "option $OPTARG requires an argument" + showHelp + exit 1 + ;; + \?) + >&2 echo "Unsupported option $OPTARG" + showHelp + exit 1 + ;; + esac +done +checkOptions + createPrivateClone # retrieve ${HISTORY_LENGTH} commits for the current directory |