]> https://gitweb.dealii.org/ - candi.git/commitdiff
add -h, validate PROCS, update README
authorTimo Heister <timo.heister@gmail.com>
Mon, 8 Feb 2016 22:24:03 +0000 (17:24 -0500)
committerTimo Heister <timo.heister@gmail.com>
Mon, 8 Feb 2016 22:24:03 +0000 (17:24 -0500)
README.md
candi.sh

index a6be86712046916ef28d10b994aaee37b8a6eaf3..5361d33abd6ad9675287fb3e50685be778e13ffa 100644 (file)
--- a/README.md
+++ b/README.md
@@ -71,14 +71,13 @@ Adapting candi to your needs
   $> ./candi.sh --prefix=Your/Prefix/Path
 ```
 
-#### CLO: Multiple build processes: `[-j<N>]`, `[--PROCS=<N>]`
+#### CLO: Multiple build processes: `[-j <N>]`, `[-j<N>]`, `[--PROCS=<N>]`
 ```bash
-  $> ./candi.sh -j<N>
+  $> ./candi.sh -j <N>
 ```
 
-* Remark: there is no whitespace character allowed between `-j` and the number `<N>`.
-* Example: using 2 build processes type `./candi.sh -j2` or `./candi.sh --PROCS=2`.
-* Be careful with that! You need to have enough system memory (e.g. at least 8GB for using 2 or more processes).
+* Example: to use 2 build processes type `./candi.sh -j2`.
+* Be careful with this option! You need to have enough system memory (e.g. at least 8GB for 2 or more processes).
 
 ### Configuration file options (CFO)
 
index c8668c7c2c892bb9a6f3930825990ef0612c42fb..2e931f753c9afe6c28c8b366ddb9050ff88389a2 100755 (executable)
--- a/candi.sh
+++ b/candi.sh
@@ -39,9 +39,26 @@ TIC_GLOBAL="$(${DATE_CMD} +%s%N)"
 
 ################################################################################
 # Parse command line input parameters
+PREFIX=~/apps/candi
+PROCS=1
+
 while [ -n "$1" ]; do
     param="$1"
     case $param in
+
+       -h|--help)
+           echo "candi (Compile & Install)"
+           echo ""
+           echo "Usage: $0 [options]"
+           echo "Options:"
+           echo "  -p <path>, --prefix=<path>  set a different prefix path (default $PREFIX)"
+           echo "  -j <N>, -j<N>, --PROCS=<N>  compile with N processes in parallel (default $PROCS)"
+           echo "  --platform=<platform>       force usage of a particular platform file"
+           echo ""
+           echo "The configuration including the choice of packages to install is stored in candi.cfg, see README.md for more information."
+           exit 0
+       ;;
+       
         #####################################
         # Prefix path
         -p=*|--prefix=*)
@@ -53,17 +70,17 @@ while [ -n "$1" ]; do
         #####################################
         # Number of maximum processes to use
         --PROCS=*)
-            NP="${param#*=}"
+            PROCS="${param#*=}"
         ;;
 
         # Make styled processes with or without space
        -j)
            shift
-            NP="${1}"
+            PROCS="${1}"
        ;;
 
         -j*)
-            NP="${param#*j}"
+            PROCS="${param#*j}"
         ;;
         
         #####################################
@@ -77,7 +94,12 @@ while [ -n "$1" ]; do
 done
 
 PREFIX_PATH=${PREFIX:-~/apps/candi}
-PROCS=${NP:-1}
+
+RE='^[0-9]+$'
+if [[ ! "$PROCS" =~ $RE || $PROCS<1 ]] ; then
+  echo "ERROR: invalid number of build processes '$PROCS'"
+  exit 1
+fi
 
 ################################################################################
 # Set download tool

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.