]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
attempting to fix #33
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Mon, 2 Feb 2009 23:04:07 +0000 (23:04 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Mon, 2 Feb 2009 23:04:07 +0000 (23:04 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@790 04377dda-e619-0410-9926-eae83683ac58

trunk/src/mkbuild

index 2c40aa51d2e7df54f228bb98dca447ecb5b55952..a61a05980c64deed47d8bfb0460e45dd43fc7f93 100755 (executable)
@@ -104,6 +104,8 @@ ${red}DESCRIPTION${normal}
             edit a mkbuild
         ${red}-wc${normal}, ${red}--working-copy${normal}
             create an unversioned mkbuild working copy
+        ${red}--get-param-copy${normal}
+            get a parameter from a given mkbuild
 
 ${red}EXAMPLES${normal}
         ${red}mkbuild -sa pyrex.mkbuild${normal}
@@ -242,6 +244,12 @@ function set_parameters {
         ACTION='working_copy'
         break # we need to break otherwise specific arguments are evalued
       ;;
+      '--get-param')
+        # Get parameter for a given mkbuild
+        set_mkbuild_name $2
+        ACTION='get_param'
+        break # we need to break otherwise specific arguments are evalued
+      ;;
       '-d'|'--debug')
         # Debug mode
         set -x
@@ -1706,6 +1714,19 @@ function working_copy {
 
 }
 
+function get_param {
+
+  # get a parameter from a mkbuild file
+  # usage: get_param <parameter>
+
+  local parameter="`echo $* | tr '[:lower:]' '[:upper:] | tr -d '"' | tr -d "'"'`"
+
+  if [ -e "$MKBUILD_NAME" ]; then
+    grep -e "\[\[$parameter\]\]" $MKBUILD_NAME | cut -d = -f 2 | tr -d '"' | tr -d "'"
+  fi
+
+}
+
 # ----------------------------------------------------------------
 
 #=============================
@@ -1811,6 +1832,10 @@ case $ACTION in
   'working_copy')
     working_copy
   ;;
+  'get_param')
+    shift 2
+    get_param $*
+  ;;
 esac
 
 # Clear temporary files