From c7ef9143d86d5aaed70a011bfcc52627fe4203cc Mon Sep 17 00:00:00 2001 From: rhatto Date: Mon, 2 Feb 2009 23:04:07 +0000 Subject: attempting to fix #33 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@790 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/mkbuild | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index 2c40aa5..a61a059 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -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 + + 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 -- cgit v1.2.3